Skip to content

Commit a9cd996

Browse files
Merge pull request #32 from OneBusAway/release-please--branches--main--changes--next
release: 0.1.0-alpha.8
2 parents 28e02f7 + 19f0f30 commit a9cd996

File tree

14 files changed

+455
-5
lines changed

14 files changed

+455
-5
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.7"
2+
".": "0.1.0-alpha.8"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 16
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-7a71bec90a568b0dbefc3d81206069d9759259460cffa0543b162f6835be1e9a.yml
1+
configured_endpoints: 17
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-160e2615de51b1febaeb9f4a2fbbb7e70939e1ebec74946e7ec1e026868fed7e.yml

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.1.0-alpha.8 (2024-07-30)
4+
5+
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)
6+
7+
### Features
8+
9+
* **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))
10+
311
## 0.1.0-alpha.7 (2024-07-29)
412

513
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)

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,18 @@ Methods:
112112

113113
- <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>
114114

115+
# ScheduleForStop
116+
117+
Types:
118+
119+
```python
120+
from onebusaway.types import ScheduleForStopRetrieveResponse
121+
```
122+
123+
Methods:
124+
125+
- <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>
126+
115127
# Route
116128

117129
Types:

examples/schedule_for_stop.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import onebusaway
2+
3+
4+
def main_sync() -> None:
5+
client = onebusaway.OnebusawaySDK(api_key="TEST")
6+
stop_id = "1_75403"
7+
schedule_for_stop = client.schedule_for_stop.retrieve(stop_id)
8+
9+
if schedule_for_stop.data and schedule_for_stop.data.entry:
10+
print(schedule_for_stop.data.entry)
11+
else:
12+
print("schedule data or entry is None.")
13+
14+
15+
if __name__ == "__main__":
16+
main_sync()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "onebusaway"
3-
version = "0.1.0-alpha.7"
3+
version = "0.1.0-alpha.8"
44
description = "The official Python library for the onebusaway-sdk API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/onebusaway/_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class OnebusawaySDK(SyncAPIClient):
5555
stops_for_route: resources.StopsForRouteResource
5656
stop: resources.StopResource
5757
stop_ids_for_agency: resources.StopIDsForAgencyResource
58+
schedule_for_stop: resources.ScheduleForStopResource
5859
route: resources.RouteResource
5960
arrival_and_departure: resources.ArrivalAndDepartureResource
6061
trip: resources.TripResource
@@ -127,6 +128,7 @@ def __init__(
127128
self.stops_for_route = resources.StopsForRouteResource(self)
128129
self.stop = resources.StopResource(self)
129130
self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self)
131+
self.schedule_for_stop = resources.ScheduleForStopResource(self)
130132
self.route = resources.RouteResource(self)
131133
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
132134
self.trip = resources.TripResource(self)
@@ -259,6 +261,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
259261
stops_for_route: resources.AsyncStopsForRouteResource
260262
stop: resources.AsyncStopResource
261263
stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource
264+
schedule_for_stop: resources.AsyncScheduleForStopResource
262265
route: resources.AsyncRouteResource
263266
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
264267
trip: resources.AsyncTripResource
@@ -331,6 +334,7 @@ def __init__(
331334
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
332335
self.stop = resources.AsyncStopResource(self)
333336
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self)
337+
self.schedule_for_stop = resources.AsyncScheduleForStopResource(self)
334338
self.route = resources.AsyncRouteResource(self)
335339
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
336340
self.trip = resources.AsyncTripResource(self)
@@ -466,6 +470,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
466470
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
467471
self.stop = resources.StopResourceWithRawResponse(client.stop)
468472
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
473+
self.schedule_for_stop = resources.ScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
469474
self.route = resources.RouteResourceWithRawResponse(client.route)
470475
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
471476
self.trip = resources.TripResourceWithRawResponse(client.trip)
@@ -487,6 +492,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
487492
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
488493
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
489494
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
495+
self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithRawResponse(client.schedule_for_stop)
490496
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
491497
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
492498
client.arrival_and_departure
@@ -510,6 +516,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
510516
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
511517
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
512518
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency)
519+
self.schedule_for_stop = resources.ScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop)
513520
self.route = resources.RouteResourceWithStreamingResponse(client.route)
514521
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
515522
client.arrival_and_departure
@@ -539,6 +546,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
539546
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse(
540547
client.stop_ids_for_agency
541548
)
549+
self.schedule_for_stop = resources.AsyncScheduleForStopResourceWithStreamingResponse(client.schedule_for_stop)
542550
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
543551
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
544552
client.arrival_and_departure

src/onebusaway/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "onebusaway"
4-
__version__ = "0.1.0-alpha.7" # x-release-please-version
4+
__version__ = "0.1.0-alpha.8" # x-release-please-version

src/onebusaway/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@
7272
TripForVehicleResourceWithStreamingResponse,
7373
AsyncTripForVehicleResourceWithStreamingResponse,
7474
)
75+
from .schedule_for_stop import (
76+
ScheduleForStopResource,
77+
AsyncScheduleForStopResource,
78+
ScheduleForStopResourceWithRawResponse,
79+
AsyncScheduleForStopResourceWithRawResponse,
80+
ScheduleForStopResourceWithStreamingResponse,
81+
AsyncScheduleForStopResourceWithStreamingResponse,
82+
)
7583
from .stops_for_location import (
7684
StopsForLocationResource,
7785
AsyncStopsForLocationResource,
@@ -176,6 +184,12 @@
176184
"AsyncStopIDsForAgencyResourceWithRawResponse",
177185
"StopIDsForAgencyResourceWithStreamingResponse",
178186
"AsyncStopIDsForAgencyResourceWithStreamingResponse",
187+
"ScheduleForStopResource",
188+
"AsyncScheduleForStopResource",
189+
"ScheduleForStopResourceWithRawResponse",
190+
"AsyncScheduleForStopResourceWithRawResponse",
191+
"ScheduleForStopResourceWithStreamingResponse",
192+
"AsyncScheduleForStopResourceWithStreamingResponse",
179193
"RouteResource",
180194
"AsyncRouteResource",
181195
"RouteResourceWithRawResponse",
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from datetime import date
7+
8+
import httpx
9+
10+
from ..types import schedule_for_stop_retrieve_params
11+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12+
from .._utils import (
13+
maybe_transform,
14+
async_maybe_transform,
15+
)
16+
from .._compat import cached_property
17+
from .._resource import SyncAPIResource, AsyncAPIResource
18+
from .._response import (
19+
to_raw_response_wrapper,
20+
to_streamed_response_wrapper,
21+
async_to_raw_response_wrapper,
22+
async_to_streamed_response_wrapper,
23+
)
24+
from .._base_client import make_request_options
25+
from ..types.schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse
26+
27+
__all__ = ["ScheduleForStopResource", "AsyncScheduleForStopResource"]
28+
29+
30+
class ScheduleForStopResource(SyncAPIResource):
31+
@cached_property
32+
def with_raw_response(self) -> ScheduleForStopResourceWithRawResponse:
33+
return ScheduleForStopResourceWithRawResponse(self)
34+
35+
@cached_property
36+
def with_streaming_response(self) -> ScheduleForStopResourceWithStreamingResponse:
37+
return ScheduleForStopResourceWithStreamingResponse(self)
38+
39+
def retrieve(
40+
self,
41+
stop_id: str,
42+
*,
43+
date: Union[str, date] | NotGiven = NOT_GIVEN,
44+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
45+
# The extra values given here take precedence over values defined on the client or passed to this method.
46+
extra_headers: Headers | None = None,
47+
extra_query: Query | None = None,
48+
extra_body: Body | None = None,
49+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
50+
) -> ScheduleForStopRetrieveResponse:
51+
"""
52+
Get schedule for a specific stop
53+
54+
Args:
55+
date: The date for which you want to request a schedule in the format YYYY-MM-DD
56+
(optional, defaults to the current date)
57+
58+
extra_headers: Send extra headers
59+
60+
extra_query: Add additional query parameters to the request
61+
62+
extra_body: Add additional JSON properties to the request
63+
64+
timeout: Override the client-level default timeout for this request, in seconds
65+
"""
66+
if not stop_id:
67+
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
68+
return self._get(
69+
f"/api/where/schedule-for-stop/{stop_id}.json",
70+
options=make_request_options(
71+
extra_headers=extra_headers,
72+
extra_query=extra_query,
73+
extra_body=extra_body,
74+
timeout=timeout,
75+
query=maybe_transform({"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams),
76+
),
77+
cast_to=ScheduleForStopRetrieveResponse,
78+
)
79+
80+
81+
class AsyncScheduleForStopResource(AsyncAPIResource):
82+
@cached_property
83+
def with_raw_response(self) -> AsyncScheduleForStopResourceWithRawResponse:
84+
return AsyncScheduleForStopResourceWithRawResponse(self)
85+
86+
@cached_property
87+
def with_streaming_response(self) -> AsyncScheduleForStopResourceWithStreamingResponse:
88+
return AsyncScheduleForStopResourceWithStreamingResponse(self)
89+
90+
async def retrieve(
91+
self,
92+
stop_id: str,
93+
*,
94+
date: Union[str, date] | NotGiven = NOT_GIVEN,
95+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
96+
# The extra values given here take precedence over values defined on the client or passed to this method.
97+
extra_headers: Headers | None = None,
98+
extra_query: Query | None = None,
99+
extra_body: Body | None = None,
100+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
101+
) -> ScheduleForStopRetrieveResponse:
102+
"""
103+
Get schedule for a specific stop
104+
105+
Args:
106+
date: The date for which you want to request a schedule in the format YYYY-MM-DD
107+
(optional, defaults to the current date)
108+
109+
extra_headers: Send extra headers
110+
111+
extra_query: Add additional query parameters to the request
112+
113+
extra_body: Add additional JSON properties to the request
114+
115+
timeout: Override the client-level default timeout for this request, in seconds
116+
"""
117+
if not stop_id:
118+
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
119+
return await self._get(
120+
f"/api/where/schedule-for-stop/{stop_id}.json",
121+
options=make_request_options(
122+
extra_headers=extra_headers,
123+
extra_query=extra_query,
124+
extra_body=extra_body,
125+
timeout=timeout,
126+
query=await async_maybe_transform(
127+
{"date": date}, schedule_for_stop_retrieve_params.ScheduleForStopRetrieveParams
128+
),
129+
),
130+
cast_to=ScheduleForStopRetrieveResponse,
131+
)
132+
133+
134+
class ScheduleForStopResourceWithRawResponse:
135+
def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None:
136+
self._schedule_for_stop = schedule_for_stop
137+
138+
self.retrieve = to_raw_response_wrapper(
139+
schedule_for_stop.retrieve,
140+
)
141+
142+
143+
class AsyncScheduleForStopResourceWithRawResponse:
144+
def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None:
145+
self._schedule_for_stop = schedule_for_stop
146+
147+
self.retrieve = async_to_raw_response_wrapper(
148+
schedule_for_stop.retrieve,
149+
)
150+
151+
152+
class ScheduleForStopResourceWithStreamingResponse:
153+
def __init__(self, schedule_for_stop: ScheduleForStopResource) -> None:
154+
self._schedule_for_stop = schedule_for_stop
155+
156+
self.retrieve = to_streamed_response_wrapper(
157+
schedule_for_stop.retrieve,
158+
)
159+
160+
161+
class AsyncScheduleForStopResourceWithStreamingResponse:
162+
def __init__(self, schedule_for_stop: AsyncScheduleForStopResource) -> None:
163+
self._schedule_for_stop = schedule_for_stop
164+
165+
self.retrieve = async_to_streamed_response_wrapper(
166+
schedule_for_stop.retrieve,
167+
)

0 commit comments

Comments
 (0)