Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 7, 2024
1 parent 9adae4d commit 1882cdc
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 18
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6579f942268e5d39432a6348fbf1eb5850e71235e72797ed78894a3329fbb25e.yml
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-321de3032fb9e1dd70c112bc3f172d12a36692f8fcfa2e8aec47ab6a85ca37e2.yml
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ Methods:

- <code title="get /api/where/route-ids-for-agency/{agencyID}.json">client.route_ids_for_agency.<a href="./src/onebusaway/resources/route_ids_for_agency.py">list</a>(agency_id) -> <a href="./src/onebusaway/types/route_ids_for_agency_list_response.py">RouteIDsForAgencyListResponse</a></code>

# RoutesForAgency

Types:

```python
from onebusaway.types import RoutesForAgencyListResponse
```

Methods:

- <code title="get /api/where/routes-for-agency/{agencyID}.json">client.routes_for_agency.<a href="./src/onebusaway/resources/routes_for_agency.py">list</a>(agency_id) -> <a href="./src/onebusaway/types/routes_for_agency_list_response.py">RoutesForAgencyListResponse</a></code>

# ArrivalAndDeparture

Types:
Expand Down
8 changes: 8 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class OnebusawaySDK(SyncAPIClient):
schedule_for_stop: resources.ScheduleForStopResource
route: resources.RouteResource
route_ids_for_agency: resources.RouteIDsForAgencyResource
routes_for_agency: resources.RoutesForAgencyResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
trips_for_location: resources.TripsForLocationResource
Expand Down Expand Up @@ -132,6 +133,7 @@ def __init__(
self.schedule_for_stop = resources.ScheduleForStopResource(self)
self.route = resources.RouteResource(self)
self.route_ids_for_agency = resources.RouteIDsForAgencyResource(self)
self.routes_for_agency = resources.RoutesForAgencyResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
self.trips_for_location = resources.TripsForLocationResource(self)
Expand Down Expand Up @@ -266,6 +268,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
schedule_for_stop: resources.AsyncScheduleForStopResource
route: resources.AsyncRouteResource
route_ids_for_agency: resources.AsyncRouteIDsForAgencyResource
routes_for_agency: resources.AsyncRoutesForAgencyResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
trips_for_location: resources.AsyncTripsForLocationResource
Expand Down Expand Up @@ -340,6 +343,7 @@ def __init__(
self.schedule_for_stop = resources.AsyncScheduleForStopResource(self)
self.route = resources.AsyncRouteResource(self)
self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResource(self)
self.routes_for_agency = resources.AsyncRoutesForAgencyResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
self.trips_for_location = resources.AsyncTripsForLocationResource(self)
Expand Down Expand Up @@ -477,6 +481,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency)
self.routes_for_agency = resources.RoutesForAgencyResourceWithRawResponse(client.routes_for_agency)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location)
Expand All @@ -500,6 +505,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithRawResponse(client.route_ids_for_agency)
self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithRawResponse(client.routes_for_agency)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
)
Expand Down Expand Up @@ -527,6 +533,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.route_ids_for_agency = resources.RouteIDsForAgencyResourceWithStreamingResponse(
client.route_ids_for_agency
)
self.routes_for_agency = resources.RoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
)
Expand Down Expand Up @@ -560,6 +567,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.route_ids_for_agency = resources.AsyncRouteIDsForAgencyResourceWithStreamingResponse(
client.route_ids_for_agency
)
self.routes_for_agency = resources.AsyncRoutesForAgencyResourceWithStreamingResponse(client.routes_for_agency)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
)
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 @@ -72,6 +72,14 @@
TripForVehicleResourceWithStreamingResponse,
AsyncTripForVehicleResourceWithStreamingResponse,
)
from .routes_for_agency import (
RoutesForAgencyResource,
AsyncRoutesForAgencyResource,
RoutesForAgencyResourceWithRawResponse,
AsyncRoutesForAgencyResourceWithRawResponse,
RoutesForAgencyResourceWithStreamingResponse,
AsyncRoutesForAgencyResourceWithStreamingResponse,
)
from .schedule_for_stop import (
ScheduleForStopResource,
AsyncScheduleForStopResource,
Expand Down Expand Up @@ -210,6 +218,12 @@
"AsyncRouteIDsForAgencyResourceWithRawResponse",
"RouteIDsForAgencyResourceWithStreamingResponse",
"AsyncRouteIDsForAgencyResourceWithStreamingResponse",
"RoutesForAgencyResource",
"AsyncRoutesForAgencyResource",
"RoutesForAgencyResourceWithRawResponse",
"AsyncRoutesForAgencyResourceWithRawResponse",
"RoutesForAgencyResourceWithStreamingResponse",
"AsyncRoutesForAgencyResourceWithStreamingResponse",
"ArrivalAndDepartureResource",
"AsyncArrivalAndDepartureResource",
"ArrivalAndDepartureResourceWithRawResponse",
Expand Down
141 changes: 141 additions & 0 deletions src/onebusaway/resources/routes_for_agency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.routes_for_agency_list_response import RoutesForAgencyListResponse

__all__ = ["RoutesForAgencyResource", "AsyncRoutesForAgencyResource"]


class RoutesForAgencyResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> RoutesForAgencyResourceWithRawResponse:
return RoutesForAgencyResourceWithRawResponse(self)

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

def list(
self,
agency_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> RoutesForAgencyListResponse:
"""
Retrieve the list of all routes for a particular agency by id
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return self._get(
f"/api/where/routes-for-agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=RoutesForAgencyListResponse,
)


class AsyncRoutesForAgencyResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncRoutesForAgencyResourceWithRawResponse:
return AsyncRoutesForAgencyResourceWithRawResponse(self)

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

async def list(
self,
agency_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> RoutesForAgencyListResponse:
"""
Retrieve the list of all routes for a particular agency by id
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return await self._get(
f"/api/where/routes-for-agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=RoutesForAgencyListResponse,
)


class RoutesForAgencyResourceWithRawResponse:
def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None:
self._routes_for_agency = routes_for_agency

self.list = to_raw_response_wrapper(
routes_for_agency.list,
)


class AsyncRoutesForAgencyResourceWithRawResponse:
def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None:
self._routes_for_agency = routes_for_agency

self.list = async_to_raw_response_wrapper(
routes_for_agency.list,
)


class RoutesForAgencyResourceWithStreamingResponse:
def __init__(self, routes_for_agency: RoutesForAgencyResource) -> None:
self._routes_for_agency = routes_for_agency

self.list = to_streamed_response_wrapper(
routes_for_agency.list,
)


class AsyncRoutesForAgencyResourceWithStreamingResponse:
def __init__(self, routes_for_agency: AsyncRoutesForAgencyResource) -> None:
self._routes_for_agency = routes_for_agency

self.list = async_to_streamed_response_wrapper(
routes_for_agency.list,
)
1 change: 1 addition & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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 .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse
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
Expand Down
45 changes: 45 additions & 0 deletions src/onebusaway/types/routes_for_agency_list_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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__ = ["RoutesForAgencyListResponse", "RoutesForAgencyListResponseData", "RoutesForAgencyListResponseDataList"]


class RoutesForAgencyListResponseDataList(BaseModel):
id: Optional[str] = None

agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None)

color: Optional[str] = None

description: Optional[str] = None

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


class RoutesForAgencyListResponseData(BaseModel):
limit_exceeded: bool = FieldInfo(alias="limitExceeded")

list: List[RoutesForAgencyListResponseDataList]

references: References


class RoutesForAgencyListResponse(ResponseWrapper):
data: RoutesForAgencyListResponseData
Loading

0 comments on commit 1882cdc

Please sign in to comment.