-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): OpenAPI spec update via Stainless API (#6)
- Loading branch information
1 parent
fc1679d
commit b6a54cf
Showing
8 changed files
with
330 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 13 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml | ||
configured_endpoints: 14 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-3a44d3a64c0f613f81e7dd42644c2b2df90e8be20210428450149f771c7f13d8.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
import httpx | ||
|
||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven | ||
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.stop_retrieve_response import StopRetrieveResponse | ||
|
||
__all__ = ["StopResource", "AsyncStopResource"] | ||
|
||
|
||
class StopResource(SyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> StopResourceWithRawResponse: | ||
return StopResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> StopResourceWithStreamingResponse: | ||
return StopResourceWithStreamingResponse(self) | ||
|
||
def retrieve( | ||
self, | ||
stop_id: str, | ||
*, | ||
# 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, | ||
) -> StopRetrieveResponse: | ||
""" | ||
Retrieve information for a specific stop identified by its unique ID. | ||
Args: | ||
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/stop/stopID.json", | ||
options=make_request_options( | ||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout | ||
), | ||
cast_to=StopRetrieveResponse, | ||
) | ||
|
||
|
||
class AsyncStopResource(AsyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> AsyncStopResourceWithRawResponse: | ||
return AsyncStopResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse: | ||
return AsyncStopResourceWithStreamingResponse(self) | ||
|
||
async def retrieve( | ||
self, | ||
stop_id: str, | ||
*, | ||
# 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, | ||
) -> StopRetrieveResponse: | ||
""" | ||
Retrieve information for a specific stop identified by its unique ID. | ||
Args: | ||
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/stop/stopID.json", | ||
options=make_request_options( | ||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout | ||
), | ||
cast_to=StopRetrieveResponse, | ||
) | ||
|
||
|
||
class StopResourceWithRawResponse: | ||
def __init__(self, stop: StopResource) -> None: | ||
self._stop = stop | ||
|
||
self.retrieve = to_raw_response_wrapper( | ||
stop.retrieve, | ||
) | ||
|
||
|
||
class AsyncStopResourceWithRawResponse: | ||
def __init__(self, stop: AsyncStopResource) -> None: | ||
self._stop = stop | ||
|
||
self.retrieve = async_to_raw_response_wrapper( | ||
stop.retrieve, | ||
) | ||
|
||
|
||
class StopResourceWithStreamingResponse: | ||
def __init__(self, stop: StopResource) -> None: | ||
self._stop = stop | ||
|
||
self.retrieve = to_streamed_response_wrapper( | ||
stop.retrieve, | ||
) | ||
|
||
|
||
class AsyncStopResourceWithStreamingResponse: | ||
def __init__(self, stop: AsyncStopResource) -> None: | ||
self._stop = stop | ||
|
||
self.retrieve = async_to_streamed_response_wrapper( | ||
stop.retrieve, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from typing import List, Optional | ||
|
||
from pydantic import Field as FieldInfo | ||
|
||
from .._models import BaseModel | ||
from .shared.references import References | ||
from .shared.response_wrapper import ResponseWrapper | ||
|
||
__all__ = [ | ||
"StopRetrieveResponse", | ||
"StopRetrieveResponseData", | ||
"StopRetrieveResponseDataData", | ||
"StopRetrieveResponseDataDataEntry", | ||
] | ||
|
||
|
||
class StopRetrieveResponseDataDataEntry(BaseModel): | ||
id: str | ||
|
||
code: str | ||
|
||
lat: float | ||
|
||
lon: float | ||
|
||
name: str | ||
|
||
direction: Optional[str] = None | ||
|
||
location_type: Optional[int] = FieldInfo(alias="locationType", default=None) | ||
|
||
parent: Optional[str] = None | ||
|
||
route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None) | ||
|
||
static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None) | ||
|
||
wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) | ||
|
||
|
||
class StopRetrieveResponseDataData(BaseModel): | ||
entry: Optional[StopRetrieveResponseDataDataEntry] = None | ||
|
||
references: Optional[References] = None | ||
|
||
|
||
class StopRetrieveResponseData(BaseModel): | ||
data: Optional[StopRetrieveResponseDataData] = None | ||
|
||
|
||
class StopRetrieveResponse(ResponseWrapper): | ||
data: Optional[StopRetrieveResponseData] = None |
Oops, something went wrong.