Skip to content

Commit 876b77c

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#71)
1 parent 256a433 commit 876b77c

File tree

8 files changed

+481
-2
lines changed

8 files changed

+481
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 24
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-9c3d349c8e661f7dc8c2585d02f334bb6ba3456f0d929c44d46454a0d190af7b.yml
1+
configured_endpoints: 25
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-af6147ab6853e8f03d6d9df903ce1c1a36d6663e5a0c9f99524c4b4c9014a72c.yml

api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ Methods:
251251

252252
- <code title="get /api/where/report-problem-with-stop/{stopID}.json">client.report_problem_with_stop.<a href="./src/onebusaway/resources/report_problem_with_stop.py">retrieve</a>(stop_id, \*\*<a href="src/onebusaway/types/report_problem_with_stop_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/shared/response_wrapper.py">ResponseWrapper</a></code>
253253

254+
# ReportProblemWithTrip
255+
256+
Methods:
257+
258+
- <code title="get /api/where/report-problem-with-trip/{tripID}.json">client.report_problem_with_trip.<a href="./src/onebusaway/resources/report_problem_with_trip.py">retrieve</a>(trip_id, \*\*<a href="src/onebusaway/types/report_problem_with_trip_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/shared/response_wrapper.py">ResponseWrapper</a></code>
259+
254260
# SearchForStop
255261

256262
Types:

src/onebusaway/_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class OnebusawaySDK(SyncAPIClient):
6767
trip_details: resources.TripDetailsResource
6868
trip_for_vehicle: resources.TripForVehicleResource
6969
report_problem_with_stop: resources.ReportProblemWithStopResource
70+
report_problem_with_trip: resources.ReportProblemWithTripResource
7071
search_for_stop: resources.SearchForStopResource
7172
search_for_route: resources.SearchForRouteResource
7273
with_raw_response: OnebusawaySDKWithRawResponse
@@ -147,6 +148,7 @@ def __init__(
147148
self.trip_details = resources.TripDetailsResource(self)
148149
self.trip_for_vehicle = resources.TripForVehicleResource(self)
149150
self.report_problem_with_stop = resources.ReportProblemWithStopResource(self)
151+
self.report_problem_with_trip = resources.ReportProblemWithTripResource(self)
150152
self.search_for_stop = resources.SearchForStopResource(self)
151153
self.search_for_route = resources.SearchForRouteResource(self)
152154
self.with_raw_response = OnebusawaySDKWithRawResponse(self)
@@ -287,6 +289,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
287289
trip_details: resources.AsyncTripDetailsResource
288290
trip_for_vehicle: resources.AsyncTripForVehicleResource
289291
report_problem_with_stop: resources.AsyncReportProblemWithStopResource
292+
report_problem_with_trip: resources.AsyncReportProblemWithTripResource
290293
search_for_stop: resources.AsyncSearchForStopResource
291294
search_for_route: resources.AsyncSearchForRouteResource
292295
with_raw_response: AsyncOnebusawaySDKWithRawResponse
@@ -367,6 +370,7 @@ def __init__(
367370
self.trip_details = resources.AsyncTripDetailsResource(self)
368371
self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self)
369372
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self)
373+
self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self)
370374
self.search_for_stop = resources.AsyncSearchForStopResource(self)
371375
self.search_for_route = resources.AsyncSearchForRouteResource(self)
372376
self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self)
@@ -512,6 +516,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
512516
self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse(
513517
client.report_problem_with_stop
514518
)
519+
self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithRawResponse(
520+
client.report_problem_with_trip
521+
)
515522
self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop)
516523
self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route)
517524

@@ -545,6 +552,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
545552
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse(
546553
client.report_problem_with_stop
547554
)
555+
self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithRawResponse(
556+
client.report_problem_with_trip
557+
)
548558
self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop)
549559
self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route)
550560

@@ -580,6 +590,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
580590
self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse(
581591
client.report_problem_with_stop
582592
)
593+
self.report_problem_with_trip = resources.ReportProblemWithTripResourceWithStreamingResponse(
594+
client.report_problem_with_trip
595+
)
583596
self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop)
584597
self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route)
585598

@@ -627,6 +640,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
627640
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse(
628641
client.report_problem_with_stop
629642
)
643+
self.report_problem_with_trip = resources.AsyncReportProblemWithTripResourceWithStreamingResponse(
644+
client.report_problem_with_trip
645+
)
630646
self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop)
631647
self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route)
632648

src/onebusaway/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@
184184
ReportProblemWithStopResourceWithStreamingResponse,
185185
AsyncReportProblemWithStopResourceWithStreamingResponse,
186186
)
187+
from .report_problem_with_trip import (
188+
ReportProblemWithTripResource,
189+
AsyncReportProblemWithTripResource,
190+
ReportProblemWithTripResourceWithRawResponse,
191+
AsyncReportProblemWithTripResourceWithRawResponse,
192+
ReportProblemWithTripResourceWithStreamingResponse,
193+
AsyncReportProblemWithTripResourceWithStreamingResponse,
194+
)
187195

188196
__all__ = [
189197
"AgenciesWithCoverageResource",
@@ -312,6 +320,12 @@
312320
"AsyncReportProblemWithStopResourceWithRawResponse",
313321
"ReportProblemWithStopResourceWithStreamingResponse",
314322
"AsyncReportProblemWithStopResourceWithStreamingResponse",
323+
"ReportProblemWithTripResource",
324+
"AsyncReportProblemWithTripResource",
325+
"ReportProblemWithTripResourceWithRawResponse",
326+
"AsyncReportProblemWithTripResourceWithRawResponse",
327+
"ReportProblemWithTripResourceWithStreamingResponse",
328+
"AsyncReportProblemWithTripResourceWithStreamingResponse",
315329
"SearchForStopResource",
316330
"AsyncSearchForStopResource",
317331
"SearchForStopResourceWithRawResponse",
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal
6+
7+
import httpx
8+
9+
from ..types import report_problem_with_trip_retrieve_params
10+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11+
from .._utils import (
12+
maybe_transform,
13+
async_maybe_transform,
14+
)
15+
from .._compat import cached_property
16+
from .._resource import SyncAPIResource, AsyncAPIResource
17+
from .._response import (
18+
to_raw_response_wrapper,
19+
to_streamed_response_wrapper,
20+
async_to_raw_response_wrapper,
21+
async_to_streamed_response_wrapper,
22+
)
23+
from .._base_client import make_request_options
24+
from ..types.shared.response_wrapper import ResponseWrapper
25+
26+
__all__ = ["ReportProblemWithTripResource", "AsyncReportProblemWithTripResource"]
27+
28+
29+
class ReportProblemWithTripResource(SyncAPIResource):
30+
@cached_property
31+
def with_raw_response(self) -> ReportProblemWithTripResourceWithRawResponse:
32+
return ReportProblemWithTripResourceWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> ReportProblemWithTripResourceWithStreamingResponse:
36+
return ReportProblemWithTripResourceWithStreamingResponse(self)
37+
38+
def retrieve(
39+
self,
40+
trip_id: str,
41+
*,
42+
code: Literal[
43+
"vehicle_never_came",
44+
"vehicle_came_early",
45+
"vehicle_came_late",
46+
"wrong_headsign",
47+
"vehicle_does_not_stop_here",
48+
"other",
49+
]
50+
| NotGiven = NOT_GIVEN,
51+
service_date: int | NotGiven = NOT_GIVEN,
52+
stop_id: str | NotGiven = NOT_GIVEN,
53+
user_comment: str | NotGiven = NOT_GIVEN,
54+
user_lat: float | NotGiven = NOT_GIVEN,
55+
user_location_accuracy: float | NotGiven = NOT_GIVEN,
56+
user_lon: float | NotGiven = NOT_GIVEN,
57+
user_on_vehicle: bool | NotGiven = NOT_GIVEN,
58+
user_vehicle_number: str | NotGiven = NOT_GIVEN,
59+
vehicle_id: str | NotGiven = NOT_GIVEN,
60+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
61+
# The extra values given here take precedence over values defined on the client or passed to this method.
62+
extra_headers: Headers | None = None,
63+
extra_query: Query | None = None,
64+
extra_body: Body | None = None,
65+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66+
) -> ResponseWrapper:
67+
"""
68+
Submit a user-generated problem report for a particular trip.
69+
70+
Args:
71+
code: A string code identifying the nature of the problem
72+
73+
service_date: The service date of the trip
74+
75+
stop_id: A stop ID indicating where the user is experiencing the problem
76+
77+
user_comment: Additional comment text supplied by the user describing the problem
78+
79+
user_lat: The reporting user’s current latitude
80+
81+
user_location_accuracy: The reporting user’s location accuracy, in meters
82+
83+
user_lon: The reporting user’s current longitude
84+
85+
user_on_vehicle: Indicator if the user is on the transit vehicle experiencing the problem
86+
87+
user_vehicle_number: The vehicle number, as reported by the user
88+
89+
vehicle_id: The vehicle actively serving the trip
90+
91+
extra_headers: Send extra headers
92+
93+
extra_query: Add additional query parameters to the request
94+
95+
extra_body: Add additional JSON properties to the request
96+
97+
timeout: Override the client-level default timeout for this request, in seconds
98+
"""
99+
if not trip_id:
100+
raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}")
101+
return self._get(
102+
f"/api/where/report-problem-with-trip/{trip_id}.json",
103+
options=make_request_options(
104+
extra_headers=extra_headers,
105+
extra_query=extra_query,
106+
extra_body=extra_body,
107+
timeout=timeout,
108+
query=maybe_transform(
109+
{
110+
"code": code,
111+
"service_date": service_date,
112+
"stop_id": stop_id,
113+
"user_comment": user_comment,
114+
"user_lat": user_lat,
115+
"user_location_accuracy": user_location_accuracy,
116+
"user_lon": user_lon,
117+
"user_on_vehicle": user_on_vehicle,
118+
"user_vehicle_number": user_vehicle_number,
119+
"vehicle_id": vehicle_id,
120+
},
121+
report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams,
122+
),
123+
),
124+
cast_to=ResponseWrapper,
125+
)
126+
127+
128+
class AsyncReportProblemWithTripResource(AsyncAPIResource):
129+
@cached_property
130+
def with_raw_response(self) -> AsyncReportProblemWithTripResourceWithRawResponse:
131+
return AsyncReportProblemWithTripResourceWithRawResponse(self)
132+
133+
@cached_property
134+
def with_streaming_response(self) -> AsyncReportProblemWithTripResourceWithStreamingResponse:
135+
return AsyncReportProblemWithTripResourceWithStreamingResponse(self)
136+
137+
async def retrieve(
138+
self,
139+
trip_id: str,
140+
*,
141+
code: Literal[
142+
"vehicle_never_came",
143+
"vehicle_came_early",
144+
"vehicle_came_late",
145+
"wrong_headsign",
146+
"vehicle_does_not_stop_here",
147+
"other",
148+
]
149+
| NotGiven = NOT_GIVEN,
150+
service_date: int | NotGiven = NOT_GIVEN,
151+
stop_id: str | NotGiven = NOT_GIVEN,
152+
user_comment: str | NotGiven = NOT_GIVEN,
153+
user_lat: float | NotGiven = NOT_GIVEN,
154+
user_location_accuracy: float | NotGiven = NOT_GIVEN,
155+
user_lon: float | NotGiven = NOT_GIVEN,
156+
user_on_vehicle: bool | NotGiven = NOT_GIVEN,
157+
user_vehicle_number: str | NotGiven = NOT_GIVEN,
158+
vehicle_id: str | NotGiven = NOT_GIVEN,
159+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
160+
# The extra values given here take precedence over values defined on the client or passed to this method.
161+
extra_headers: Headers | None = None,
162+
extra_query: Query | None = None,
163+
extra_body: Body | None = None,
164+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
165+
) -> ResponseWrapper:
166+
"""
167+
Submit a user-generated problem report for a particular trip.
168+
169+
Args:
170+
code: A string code identifying the nature of the problem
171+
172+
service_date: The service date of the trip
173+
174+
stop_id: A stop ID indicating where the user is experiencing the problem
175+
176+
user_comment: Additional comment text supplied by the user describing the problem
177+
178+
user_lat: The reporting user’s current latitude
179+
180+
user_location_accuracy: The reporting user’s location accuracy, in meters
181+
182+
user_lon: The reporting user’s current longitude
183+
184+
user_on_vehicle: Indicator if the user is on the transit vehicle experiencing the problem
185+
186+
user_vehicle_number: The vehicle number, as reported by the user
187+
188+
vehicle_id: The vehicle actively serving the trip
189+
190+
extra_headers: Send extra headers
191+
192+
extra_query: Add additional query parameters to the request
193+
194+
extra_body: Add additional JSON properties to the request
195+
196+
timeout: Override the client-level default timeout for this request, in seconds
197+
"""
198+
if not trip_id:
199+
raise ValueError(f"Expected a non-empty value for `trip_id` but received {trip_id!r}")
200+
return await self._get(
201+
f"/api/where/report-problem-with-trip/{trip_id}.json",
202+
options=make_request_options(
203+
extra_headers=extra_headers,
204+
extra_query=extra_query,
205+
extra_body=extra_body,
206+
timeout=timeout,
207+
query=await async_maybe_transform(
208+
{
209+
"code": code,
210+
"service_date": service_date,
211+
"stop_id": stop_id,
212+
"user_comment": user_comment,
213+
"user_lat": user_lat,
214+
"user_location_accuracy": user_location_accuracy,
215+
"user_lon": user_lon,
216+
"user_on_vehicle": user_on_vehicle,
217+
"user_vehicle_number": user_vehicle_number,
218+
"vehicle_id": vehicle_id,
219+
},
220+
report_problem_with_trip_retrieve_params.ReportProblemWithTripRetrieveParams,
221+
),
222+
),
223+
cast_to=ResponseWrapper,
224+
)
225+
226+
227+
class ReportProblemWithTripResourceWithRawResponse:
228+
def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None:
229+
self._report_problem_with_trip = report_problem_with_trip
230+
231+
self.retrieve = to_raw_response_wrapper(
232+
report_problem_with_trip.retrieve,
233+
)
234+
235+
236+
class AsyncReportProblemWithTripResourceWithRawResponse:
237+
def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None:
238+
self._report_problem_with_trip = report_problem_with_trip
239+
240+
self.retrieve = async_to_raw_response_wrapper(
241+
report_problem_with_trip.retrieve,
242+
)
243+
244+
245+
class ReportProblemWithTripResourceWithStreamingResponse:
246+
def __init__(self, report_problem_with_trip: ReportProblemWithTripResource) -> None:
247+
self._report_problem_with_trip = report_problem_with_trip
248+
249+
self.retrieve = to_streamed_response_wrapper(
250+
report_problem_with_trip.retrieve,
251+
)
252+
253+
254+
class AsyncReportProblemWithTripResourceWithStreamingResponse:
255+
def __init__(self, report_problem_with_trip: AsyncReportProblemWithTripResource) -> None:
256+
self._report_problem_with_trip = report_problem_with_trip
257+
258+
self.retrieve = async_to_streamed_response_wrapper(
259+
report_problem_with_trip.retrieve,
260+
)

src/onebusaway/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@
5050
from .report_problem_with_stop_retrieve_params import (
5151
ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams,
5252
)
53+
from .report_problem_with_trip_retrieve_params import (
54+
ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams,
55+
)

0 commit comments

Comments
 (0)