Skip to content

Commit

Permalink
chore: configure new SDK language
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jul 8, 2024
1 parent b68b84c commit 23b3c89
Show file tree
Hide file tree
Showing 14 changed files with 584 additions and 170 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: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-c46722d0fcd86c37d5a1cfef8954810f0b2684fd5601c8e211d8e4ccd199f509.yml
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-c1ea5e90257369e139272db8e69752724a4c2ba2a4fc1a2df99b1f744fedd05f.yml
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ Methods:

- <code title="get /api/where/stops-for-location.json">client.stops_for_location.<a href="./src/onebusaway/resources/stops_for_location.py">retrieve</a>(\*\*<a href="src/onebusaway/types/stops_for_location_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/stops_for_location_retrieve_response.py">StopsForLocationRetrieveResponse</a></code>

# StopsForRoute

Types:

```python
from onebusaway.types import StopsForRouteListResponse
```

Methods:

- <code title="get /api/where/stops-for-route/{routeID}.json">client.stops_for_route.<a href="./src/onebusaway/resources/stops_for_route.py">list</a>(route_id, \*\*<a href="src/onebusaway/types/stops_for_route_list_params.py">params</a>) -> <a href="./src/onebusaway/types/stops_for_route_list_response.py">StopsForRouteListResponse</a></code>

# Route

Types:
Expand Down
18 changes: 12 additions & 6 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class OnebusawaySDK(SyncAPIClient):
config: resources.ConfigResource
current_time: resources.CurrentTimeResource
stops_for_location: resources.StopsForLocationResource
stops_for_route: resources.StopsForRouteResource
route: resources.RouteResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
Expand Down Expand Up @@ -117,6 +118,7 @@ def __init__(
self.config = resources.ConfigResource(self)
self.current_time = resources.CurrentTimeResource(self)
self.stops_for_location = resources.StopsForLocationResource(self)
self.stops_for_route = resources.StopsForRouteResource(self)
self.route = resources.RouteResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
Expand All @@ -130,9 +132,8 @@ def qs(self) -> Querystring:
return Querystring(array_format="repeat")

@property
@override
def auth_headers(self) -> dict[str, str]:
return {}
def auth_headers(self) -> httpx.Auth:
raise NotImplementedError("This auth method has not been implemented yet.")

@property
@override
Expand Down Expand Up @@ -243,6 +244,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
config: resources.AsyncConfigResource
current_time: resources.AsyncCurrentTimeResource
stops_for_location: resources.AsyncStopsForLocationResource
stops_for_route: resources.AsyncStopsForRouteResource
route: resources.AsyncRouteResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
Expand Down Expand Up @@ -309,6 +311,7 @@ def __init__(
self.config = resources.AsyncConfigResource(self)
self.current_time = resources.AsyncCurrentTimeResource(self)
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
self.route = resources.AsyncRouteResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
Expand All @@ -322,9 +325,8 @@ def qs(self) -> Querystring:
return Querystring(array_format="repeat")

@property
@override
def auth_headers(self) -> dict[str, str]:
return {}
def auth_headers(self) -> httpx.Auth:
raise NotImplementedError("This auth method has not been implemented yet.")

@property
@override
Expand Down Expand Up @@ -438,6 +440,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.config = resources.ConfigResourceWithRawResponse(client.config)
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
Expand All @@ -453,6 +456,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.config = resources.AsyncConfigResourceWithRawResponse(client.config)
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
Expand All @@ -470,6 +474,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.config = resources.ConfigResourceWithStreamingResponse(client.config)
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.route = resources.RouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand All @@ -489,6 +494,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.stops_for_location = resources.AsyncStopsForLocationResourceWithStreamingResponse(
client.stops_for_location
)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
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 @@ -40,6 +40,14 @@
CurrentTimeResourceWithStreamingResponse,
AsyncCurrentTimeResourceWithStreamingResponse,
)
from .stops_for_route import (
StopsForRouteResource,
AsyncStopsForRouteResource,
StopsForRouteResourceWithRawResponse,
AsyncStopsForRouteResourceWithRawResponse,
StopsForRouteResourceWithStreamingResponse,
AsyncStopsForRouteResourceWithStreamingResponse,
)
from .stops_for_location import (
StopsForLocationResource,
AsyncStopsForLocationResource,
Expand Down Expand Up @@ -104,6 +112,12 @@
"AsyncStopsForLocationResourceWithRawResponse",
"StopsForLocationResourceWithStreamingResponse",
"AsyncStopsForLocationResourceWithStreamingResponse",
"StopsForRouteResource",
"AsyncStopsForRouteResource",
"StopsForRouteResourceWithRawResponse",
"AsyncStopsForRouteResourceWithRawResponse",
"StopsForRouteResourceWithStreamingResponse",
"AsyncStopsForRouteResourceWithStreamingResponse",
"RouteResource",
"AsyncRouteResource",
"RouteResourceWithRawResponse",
Expand Down
4 changes: 2 additions & 2 deletions src/onebusaway/resources/agency.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def retrieve(
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/agency/{agency_id}.json",
f"/api/where/agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -99,7 +99,7 @@ async def retrieve(
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/agency/{agency_id}.json",
f"/api/where/agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
8 changes: 4 additions & 4 deletions src/onebusaway/resources/arrival_and_departure.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def retrieve(
if not stop_id:
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
return self._get(
f"/api/where/arrival-and-departure-for-stop/{stop_id}.json",
f"/api/where/arrival-and-departure-for-stop/stopID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -125,7 +125,7 @@ def list(
if not stop_id:
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
return self._get(
f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json",
f"/api/where/arrivals-and-departures-for-stop/stopID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -184,7 +184,7 @@ async def retrieve(
if not stop_id:
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
return await self._get(
f"/api/where/arrival-and-departure-for-stop/{stop_id}.json",
f"/api/where/arrival-and-departure-for-stop/stopID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -239,7 +239,7 @@ async def list(
if not stop_id:
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
return await self._get(
f"/api/where/arrivals-and-departures-for-stop/{stop_id}.json",
f"/api/where/arrivals-and-departures-for-stop/stopID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
2 changes: 1 addition & 1 deletion src/onebusaway/resources/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def retrieve(
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/route/{route_id}.json",
f"/api/where/route/routeID.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
180 changes: 180 additions & 0 deletions src/onebusaway/resources/stops_for_route.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from ..types import stops_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.stops_for_route_list_response import StopsForRouteListResponse

__all__ = ["StopsForRouteResource", "AsyncStopsForRouteResource"]


class StopsForRouteResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> StopsForRouteResourceWithRawResponse:
return StopsForRouteResourceWithRawResponse(self)

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

def list(
self,
route_id: str,
*,
include_polylines: bool | NotGiven = NOT_GIVEN,
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,
) -> StopsForRouteListResponse:
"""
Get stops for a specific route
Args:
include_polylines: Include polyline elements in the response (default true)
time: Specify service date (YYYY-MM-DD or epoch) (default today)
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/stops-for-route/routeID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"include_polylines": include_polylines,
"time": time,
},
stops_for_route_list_params.StopsForRouteListParams,
),
),
cast_to=StopsForRouteListResponse,
)


class AsyncStopsForRouteResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncStopsForRouteResourceWithRawResponse:
return AsyncStopsForRouteResourceWithRawResponse(self)

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

async def list(
self,
route_id: str,
*,
include_polylines: bool | NotGiven = NOT_GIVEN,
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,
) -> StopsForRouteListResponse:
"""
Get stops for a specific route
Args:
include_polylines: Include polyline elements in the response (default true)
time: Specify service date (YYYY-MM-DD or epoch) (default today)
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/stops-for-route/routeID.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_polylines": include_polylines,
"time": time,
},
stops_for_route_list_params.StopsForRouteListParams,
),
),
cast_to=StopsForRouteListResponse,
)


class StopsForRouteResourceWithRawResponse:
def __init__(self, stops_for_route: StopsForRouteResource) -> None:
self._stops_for_route = stops_for_route

self.list = to_raw_response_wrapper(
stops_for_route.list,
)


class AsyncStopsForRouteResourceWithRawResponse:
def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None:
self._stops_for_route = stops_for_route

self.list = async_to_raw_response_wrapper(
stops_for_route.list,
)


class StopsForRouteResourceWithStreamingResponse:
def __init__(self, stops_for_route: StopsForRouteResource) -> None:
self._stops_for_route = stops_for_route

self.list = to_streamed_response_wrapper(
stops_for_route.list,
)


class AsyncStopsForRouteResourceWithStreamingResponse:
def __init__(self, stops_for_route: AsyncStopsForRouteResource) -> None:
self._stops_for_route = stops_for_route

self.list = async_to_streamed_response_wrapper(
stops_for_route.list,
)
Loading

0 comments on commit 23b3c89

Please sign in to comment.