Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.1.0-alpha.8 #32

Merged
merged 4 commits into from
Jul 30, 2024
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
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.8"
}
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-160e2615de51b1febaeb9f4a2fbbb7e70939e1ebec74946e7ec1e026868fed7e.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 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 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.8"
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.8" # 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,
)
2 changes: 2 additions & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
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 .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams
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
from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse
from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse
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 (
Expand Down
19 changes: 19 additions & 0 deletions src/onebusaway/types/schedule_for_stop_retrieve_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import datetime
from typing import Union
from typing_extensions import Annotated, TypedDict

from .._utils import PropertyInfo

__all__ = ["ScheduleForStopRetrieveParams"]


class ScheduleForStopRetrieveParams(TypedDict, total=False):
date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")]
"""
The date for which you want to request a schedule in the format YYYY-MM-DD
(optional, defaults to the current date)
"""
Loading