Skip to content

Commit

Permalink
feat: various codegen changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Stainless Bot committed Jul 31, 2024
1 parent 48ff0f3 commit 1cba822
Show file tree
Hide file tree
Showing 34 changed files with 519 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.7"
".": "0.1.0-alpha.10"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-7a71bec90a568b0dbefc3d81206069d9759259460cffa0543b162f6835be1e9a.yml
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-261df351536029839245955df4df7341de315fe2b1d1d6aeb063eaef62bcddc9.yml
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.1.0-alpha.10 (2024-07-31)

Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)

### Features

* **api:** OpenAPI spec update via Stainless API ([#37](https://github.com/OneBusAway/python-sdk/issues/37)) ([cc7611d](https://github.com/OneBusAway/python-sdk/commit/cc7611d6984efe9cce70b1388c8bdfd14ed814d3))
* **api:** OpenAPI spec update via Stainless API ([#39](https://github.com/OneBusAway/python-sdk/issues/39)) ([45dc9fe](https://github.com/OneBusAway/python-sdk/commit/45dc9fe6b89ab5224d6f60d97d10ab85326e08fd))

## 0.1.0-alpha.9 (2024-07-31)

Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)

### Features

* **api:** OpenAPI spec update via Stainless API ([#34](https://github.com/OneBusAway/python-sdk/issues/34)) ([d60f5d7](https://github.com/OneBusAway/python-sdk/commit/d60f5d72bed809667875d4548bc4909d5125a6d5))

## 0.1.0-alpha.8 (2024-07-30)

Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)

### Features

* **api:** OpenAPI spec update via Stainless API ([#31](https://github.com/OneBusAway/python-sdk/issues/31)) ([891cdf5](https://github.com/OneBusAway/python-sdk/commit/891cdf59961594e7bfb21fc25e8615b3c536dc8e))

## 0.1.0-alpha.7 (2024-07-29)

Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ Methods:

- <code title="get /api/where/stop-ids-for-agency/{agencyID}.json">client.stop_ids_for_agency.<a href="./src/onebusaway/resources/stop_ids_for_agency.py">list</a>(agency_id) -> <a href="./src/onebusaway/types/stop_ids_for_agency_list_response.py">StopIDsForAgencyListResponse</a></code>

# ScheduleForStop

Types:

```python
from onebusaway.types import ScheduleForStopRetrieveResponse
```

Methods:

- <code title="get /api/where/schedule-for-stop/{stopID}.json">client.schedule_for_stop.<a href="./src/onebusaway/resources/schedule_for_stop.py">retrieve</a>(stop_id, \*\*<a href="src/onebusaway/types/schedule_for_stop_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/schedule_for_stop_retrieve_response.py">ScheduleForStopRetrieveResponse</a></code>

# Route

Types:
Expand Down
16 changes: 16 additions & 0 deletions examples/schedule_for_stop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import onebusaway


def main_sync() -> None:
client = onebusaway.OnebusawaySDK(api_key="TEST")
stop_id = "1_75403"
schedule_for_stop = client.schedule_for_stop.retrieve(stop_id)

if schedule_for_stop.data and schedule_for_stop.data.entry:
print(schedule_for_stop.data.entry)
else:
print("schedule data or entry is None.")


if __name__ == "__main__":
main_sync()
2 changes: 1 addition & 1 deletion examples/stop_ids_for_agency.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
stop_ids = oba.stop_ids_for_agency.list(agency_id)
if stop_ids.data and stop_ids.data.list:
for stop_id in stop_ids.data.list:
print(stop_id)
print(stop_id)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "onebusaway"
version = "0.1.0-alpha.7"
version = "0.1.0-alpha.10"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
8 changes: 8 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class OnebusawaySDK(SyncAPIClient):
stops_for_route: resources.StopsForRouteResource
stop: resources.StopResource
stop_ids_for_agency: resources.StopIDsForAgencyResource
schedule_for_stop: resources.ScheduleForStopResource
route: resources.RouteResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
Expand Down Expand Up @@ -127,6 +128,7 @@ def __init__(
self.stops_for_route = resources.StopsForRouteResource(self)
self.stop = resources.StopResource(self)
self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self)
self.schedule_for_stop = resources.ScheduleForStopResource(self)
self.route = resources.RouteResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
Expand Down Expand Up @@ -259,6 +261,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
stops_for_route: resources.AsyncStopsForRouteResource
stop: resources.AsyncStopResource
stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource
schedule_for_stop: resources.AsyncScheduleForStopResource
route: resources.AsyncRouteResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
Expand Down Expand Up @@ -331,6 +334,7 @@ def __init__(
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
self.stop = resources.AsyncStopResource(self)
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self)
self.schedule_for_stop = resources.AsyncScheduleForStopResource(self)
self.route = resources.AsyncRouteResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
Expand Down Expand Up @@ -466,6 +470,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.StopResourceWithRawResponse(client.stop)
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
Expand All @@ -487,6 +492,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
Expand All @@ -510,6 +516,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency)
self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop)
self.route = resources.RouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand Down Expand Up @@ -539,6 +546,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse(
client.stop_ids_for_agency
)
self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop)
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand Down
2 changes: 1 addition & 1 deletion src/onebusaway/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "onebusaway"
__version__ = "0.1.0-alpha.7" # x-release-please-version
__version__ = "0.1.0-alpha.10" # x-release-please-version
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 .schedule_for_stop import (
ScheduleForStopResource,
AsyncScheduleForStopResource,
ScheduleForStopResourceWithRawResponse,
AsyncScheduleForStopResourceWithRawResponse,
ScheduleForStopResourceWithStreamingResponse,
AsyncScheduleForStopResourceWithStreamingResponse,
)
from .stops_for_location import (
StopsForLocationResource,
AsyncStopsForLocationResource,
Expand Down Expand Up @@ -176,6 +184,12 @@
"AsyncStopIDsForAgencyResourceWithRawResponse",
"StopIDsForAgencyResourceWithStreamingResponse",
"AsyncStopIDsForAgencyResourceWithStreamingResponse",
"ScheduleForStopResource",
"AsyncScheduleForStopResource",
"ScheduleForStopResourceWithRawResponse",
"AsyncScheduleForStopResourceWithRawResponse",
"ScheduleForStopResourceWithStreamingResponse",
"AsyncScheduleForStopResourceWithStreamingResponse",
"RouteResource",
"AsyncRouteResource",
"RouteResourceWithRawResponse",
Expand Down
167 changes: 167 additions & 0 deletions src/onebusaway/resources/schedule_for_stop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Union
from datetime import date

import httpx

from ..types import schedule_for_stop_retrieve_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
async_maybe_transform,
)
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse

__all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"]


class ScheduleForStopResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse:
return ScheduleForStopResourceWithRawResponse(self)

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

def retrieve(
self,
stop_id: str,
*,
date: Union[str, date] | 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,
) -> ScheduleForStopRetrieveResponse:
"""
Get schedule for a specific stop
Args:
date: The date for which you want to request a schedule in the format YYYY-MM-DD
(optional, defaults to the current date)
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 stop_id:
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
return self._get(
f"/api/where/schedule-for-stop/{stop_id}.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams),
),
cast_to=ScheduleForStopRetrieveResponse,
)


class AsyncScheduleForStopResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse:
return AsyncScheduleForStopResourceWithRawResponse(self)

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

async def retrieve(
self,
stop_id: str,
*,
date: Union[str, date] | 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,
) -> ScheduleForStopRetrieveResponse:
"""
Get schedule for a specific stop
Args:
date: The date for which you want to request a schedule in the format YYYY-MM-DD
(optional, defaults to the current date)
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 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/schedule-for-stop/{stop_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(
{"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams
),
),
cast_to=ScheduleForStopRetrieveResponse,
)


class ScheduleForStopResourceWithRawResponse:
def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None:
self._schedule_for_stop = schedule_for_stop

self.retrieve = to_raw_response_wrapper(
schedule_for_stop.retrieve,
)


class AsyncScheduleForStopResourceWithRawResponse:
def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None:
self._schedule_for_stop = schedule_for_stop

self.retrieve = async_to_raw_response_wrapper(
schedule_for_stop.retrieve,
)


class ScheduleForStopResourceWithStreamingResponse:
def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None:
self._schedule_for_stop = schedule_for_stop

self.retrieve = to_streamed_response_wrapper(
schedule_for_stop.retrieve,
)


class AsyncScheduleForStopResourceWithStreamingResponse:
def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None:
self._schedule_for_stop = schedule_for_stop

self.retrieve = async_to_streamed_response_wrapper(
schedule_for_stop.retrieve,
)
4 changes: 0 additions & 4 deletions src/onebusaway/resources/stops_for_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def with_streaming_response(self) -> StopsForLocationResourceWithStreamingRespon
def retrieve(
self,
*,
key: str,
lat: float | NotGiven = NOT_GIVEN,
lon: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand Down Expand Up @@ -67,7 +66,6 @@ def retrieve(
timeout=timeout,
query=maybe_transform(
{
"key": key,
"lat": lat,
"lon": lon,
},
Expand All @@ -90,7 +88,6 @@ def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingR
async def retrieve(
self,
*,
key: str,
lat: float | NotGiven = NOT_GIVEN,
lon: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand Down Expand Up @@ -121,7 +118,6 @@ async def retrieve(
timeout=timeout,
query=await async_maybe_transform(
{
"key": key,
"lat": lat,
"lon": lon,
},
Expand Down
Loading

0 comments on commit 1cba822

Please sign in to comment.