-
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.
Loading status checks…
Merge pull request #66 from OneBusAway/release-please--branches--main…
…--changes--next release: 0.1.0-alpha.14
- v1.8.1
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.23
- v1.4.22
- v1.4.21
- v1.4.20
- v1.4.19
- v1.4.18
- v1.4.17
- v1.4.16
- v1.4.15
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.0
- v0.1.0-alpha.19
- v0.1.0-alpha.18
- v0.1.0-alpha.17
- v0.1.0-alpha.16
- v0.1.0-alpha.15
- v0.1.0-alpha.14
Showing
12 changed files
with
406 additions
and
5 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,3 +1,3 @@ | ||
{ | ||
".": "0.1.0-alpha.13" | ||
".": "0.1.0-alpha.14" | ||
} |
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: 21 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-681949f64ed7ba8d43a08daba3e5dfcee447cecc48a0a03fcf2aedef3b656641.yml | ||
configured_endpoints: 22 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-5140605804e4ff2f23c4401b0747441e07daeefb864695a4389e734b83eb07e8.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
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,4 +1,4 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
__title__ = "onebusaway" | ||
__version__ = "0.1.0-alpha.13" # x-release-please-version | ||
__version__ = "0.1.0-alpha.14" # x-release-please-version |
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,206 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
from typing_extensions import Literal | ||
|
||
import httpx | ||
|
||
from ..types import report_problem_with_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.shared.response_wrapper import ResponseWrapper | ||
|
||
__all__ = ["ReportProblemWithStopResource", "AsyncReportProblemWithStopResource"] | ||
|
||
|
||
class ReportProblemWithStopResource(SyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> ReportProblemWithStopResourceWithRawResponse: | ||
return ReportProblemWithStopResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> ReportProblemWithStopResourceWithStreamingResponse: | ||
return ReportProblemWithStopResourceWithStreamingResponse(self) | ||
|
||
def retrieve( | ||
self, | ||
stop_id: str, | ||
*, | ||
code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | ||
| NotGiven = NOT_GIVEN, | ||
user_comment: str | NotGiven = NOT_GIVEN, | ||
user_lat: float | NotGiven = NOT_GIVEN, | ||
user_location_accuracy: float | NotGiven = NOT_GIVEN, | ||
user_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. | ||
# 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, | ||
) -> ResponseWrapper: | ||
""" | ||
Submit a user-generated problem report for a stop | ||
Args: | ||
code: A string code identifying the nature of the problem | ||
user_comment: Additional comment text supplied by the user describing the problem | ||
user_lat: The reporting user’s current latitude | ||
user_location_accuracy: The reporting user’s location accuracy, in meters | ||
user_lon: The reporting user’s current longitude | ||
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/report-problem-with-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( | ||
{ | ||
"code": code, | ||
"user_comment": user_comment, | ||
"user_lat": user_lat, | ||
"user_location_accuracy": user_location_accuracy, | ||
"user_lon": user_lon, | ||
}, | ||
report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, | ||
), | ||
), | ||
cast_to=ResponseWrapper, | ||
) | ||
|
||
|
||
class AsyncReportProblemWithStopResource(AsyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> AsyncReportProblemWithStopResourceWithRawResponse: | ||
return AsyncReportProblemWithStopResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> AsyncReportProblemWithStopResourceWithStreamingResponse: | ||
return AsyncReportProblemWithStopResourceWithStreamingResponse(self) | ||
|
||
async def retrieve( | ||
self, | ||
stop_id: str, | ||
*, | ||
code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | ||
| NotGiven = NOT_GIVEN, | ||
user_comment: str | NotGiven = NOT_GIVEN, | ||
user_lat: float | NotGiven = NOT_GIVEN, | ||
user_location_accuracy: float | NotGiven = NOT_GIVEN, | ||
user_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. | ||
# 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, | ||
) -> ResponseWrapper: | ||
""" | ||
Submit a user-generated problem report for a stop | ||
Args: | ||
code: A string code identifying the nature of the problem | ||
user_comment: Additional comment text supplied by the user describing the problem | ||
user_lat: The reporting user’s current latitude | ||
user_location_accuracy: The reporting user’s location accuracy, in meters | ||
user_lon: The reporting user’s current longitude | ||
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/report-problem-with-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( | ||
{ | ||
"code": code, | ||
"user_comment": user_comment, | ||
"user_lat": user_lat, | ||
"user_location_accuracy": user_location_accuracy, | ||
"user_lon": user_lon, | ||
}, | ||
report_problem_with_stop_retrieve_params.ReportProblemWithStopRetrieveParams, | ||
), | ||
), | ||
cast_to=ResponseWrapper, | ||
) | ||
|
||
|
||
class ReportProblemWithStopResourceWithRawResponse: | ||
def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: | ||
self._report_problem_with_stop = report_problem_with_stop | ||
|
||
self.retrieve = to_raw_response_wrapper( | ||
report_problem_with_stop.retrieve, | ||
) | ||
|
||
|
||
class AsyncReportProblemWithStopResourceWithRawResponse: | ||
def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: | ||
self._report_problem_with_stop = report_problem_with_stop | ||
|
||
self.retrieve = async_to_raw_response_wrapper( | ||
report_problem_with_stop.retrieve, | ||
) | ||
|
||
|
||
class ReportProblemWithStopResourceWithStreamingResponse: | ||
def __init__(self, report_problem_with_stop: ReportProblemWithStopResource) -> None: | ||
self._report_problem_with_stop = report_problem_with_stop | ||
|
||
self.retrieve = to_streamed_response_wrapper( | ||
report_problem_with_stop.retrieve, | ||
) | ||
|
||
|
||
class AsyncReportProblemWithStopResourceWithStreamingResponse: | ||
def __init__(self, report_problem_with_stop: AsyncReportProblemWithStopResource) -> None: | ||
self._report_problem_with_stop = report_problem_with_stop | ||
|
||
self.retrieve = async_to_streamed_response_wrapper( | ||
report_problem_with_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
26 changes: 26 additions & 0 deletions
26
src/onebusaway/types/report_problem_with_stop_retrieve_params.py
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,26 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
from typing_extensions import Literal, Annotated, TypedDict | ||
|
||
from .._utils import PropertyInfo | ||
|
||
__all__ = ["ReportProblemWithStopRetrieveParams"] | ||
|
||
|
||
class ReportProblemWithStopRetrieveParams(TypedDict, total=False): | ||
code: Literal["stop_name_wrong", "stop_number_wrong", "stop_location_wrong", "route_or_trip_missing", "other"] | ||
"""A string code identifying the nature of the problem""" | ||
|
||
user_comment: Annotated[str, PropertyInfo(alias="userComment")] | ||
"""Additional comment text supplied by the user describing the problem""" | ||
|
||
user_lat: Annotated[float, PropertyInfo(alias="userLat")] | ||
"""The reporting user’s current latitude""" | ||
|
||
user_location_accuracy: Annotated[float, PropertyInfo(alias="userLocationAccuracy")] | ||
"""The reporting user’s location accuracy, in meters""" | ||
|
||
user_lon: Annotated[float, PropertyInfo(alias="userLon")] | ||
"""The reporting user’s current longitude""" |
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,122 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
import os | ||
from typing import Any, cast | ||
|
||
import pytest | ||
|
||
from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK | ||
from tests.utils import assert_matches_type | ||
from onebusaway.types.shared import ResponseWrapper | ||
|
||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") | ||
|
||
|
||
class TestReportProblemWithStop: | ||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) | ||
|
||
@parametrize | ||
def test_method_retrieve(self, client: OnebusawaySDK) -> None: | ||
report_problem_with_stop = client.report_problem_with_stop.retrieve( | ||
stop_id="stopID", | ||
) | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: | ||
report_problem_with_stop = client.report_problem_with_stop.retrieve( | ||
stop_id="stopID", | ||
code="stop_name_wrong", | ||
user_comment="userComment", | ||
user_lat=0, | ||
user_location_accuracy=0, | ||
user_lon=0, | ||
) | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: | ||
response = client.report_problem_with_stop.with_raw_response.retrieve( | ||
stop_id="stopID", | ||
) | ||
|
||
assert response.is_closed is True | ||
assert response.http_request.headers.get("X-Stainless-Lang") == "python" | ||
report_problem_with_stop = response.parse() | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: | ||
with client.report_problem_with_stop.with_streaming_response.retrieve( | ||
stop_id="stopID", | ||
) as response: | ||
assert not response.is_closed | ||
assert response.http_request.headers.get("X-Stainless-Lang") == "python" | ||
|
||
report_problem_with_stop = response.parse() | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
assert cast(Any, response.is_closed) is True | ||
|
||
@parametrize | ||
def test_path_params_retrieve(self, client: OnebusawaySDK) -> None: | ||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): | ||
client.report_problem_with_stop.with_raw_response.retrieve( | ||
stop_id="", | ||
) | ||
|
||
|
||
class TestAsyncReportProblemWithStop: | ||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) | ||
|
||
@parametrize | ||
async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: | ||
report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( | ||
stop_id="stopID", | ||
) | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: | ||
report_problem_with_stop = await async_client.report_problem_with_stop.retrieve( | ||
stop_id="stopID", | ||
code="stop_name_wrong", | ||
user_comment="userComment", | ||
user_lat=0, | ||
user_location_accuracy=0, | ||
user_lon=0, | ||
) | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: | ||
response = await async_client.report_problem_with_stop.with_raw_response.retrieve( | ||
stop_id="stopID", | ||
) | ||
|
||
assert response.is_closed is True | ||
assert response.http_request.headers.get("X-Stainless-Lang") == "python" | ||
report_problem_with_stop = await response.parse() | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
@parametrize | ||
async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: | ||
async with async_client.report_problem_with_stop.with_streaming_response.retrieve( | ||
stop_id="stopID", | ||
) as response: | ||
assert not response.is_closed | ||
assert response.http_request.headers.get("X-Stainless-Lang") == "python" | ||
|
||
report_problem_with_stop = await response.parse() | ||
assert_matches_type(ResponseWrapper, report_problem_with_stop, path=["response"]) | ||
|
||
assert cast(Any, response.is_closed) is True | ||
|
||
@parametrize | ||
async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: | ||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `stop_id` but received ''"): | ||
await async_client.report_problem_with_stop.with_raw_response.retrieve( | ||
stop_id="", | ||
) |