Skip to content

Commit

Permalink
Merge pull request #66 from OneBusAway/release-please--branches--main…
Browse files Browse the repository at this point in the history
…--changes--next

release: 0.1.0-alpha.14
Ahmedhossamdev authored Aug 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents d472196 + 32652dc commit bf43bf1
Showing 12 changed files with 406 additions and 5 deletions.
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.13"
".": "0.1.0-alpha.14"
}
4 changes: 2 additions & 2 deletions .stats.yml
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
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.14 (2024-08-08)

Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)

### Features

* **api:** OpenAPI spec update via Stainless API ([#65](https://github.com/OneBusAway/python-sdk/issues/65)) ([d93e82a](https://github.com/OneBusAway/python-sdk/commit/d93e82a4b6410768f1d5f9cd08ee83157eb405ce))

## 0.1.0-alpha.13 (2024-08-08)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
6 changes: 6 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
@@ -244,3 +244,9 @@ from onebusaway.types import TripForVehicleRetrieveResponse
Methods:

- <code title="get /api/where/trip-for-vehicle/{vehicleID}.json">client.trip_for_vehicle.<a href="./src/onebusaway/resources/trip_for_vehicle.py">retrieve</a>(vehicle_id, \*\*<a href="src/onebusaway/types/trip_for_vehicle_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/trip_for_vehicle_retrieve_response.py">TripForVehicleRetrieveResponse</a></code>

# ReportProblemWithStop

Methods:

- <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>
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.13"
version = "0.1.0-alpha.14"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
16 changes: 16 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@ class OnebusawaySDK(SyncAPIClient):
trips_for_location: resources.TripsForLocationResource
trip_details: resources.TripDetailsResource
trip_for_vehicle: resources.TripForVehicleResource
report_problem_with_stop: resources.ReportProblemWithStopResource
with_raw_response: OnebusawaySDKWithRawResponse
with_streaming_response: OnebusawaySDKWithStreamedResponse

@@ -143,6 +144,7 @@ def __init__(
self.trips_for_location = resources.TripsForLocationResource(self)
self.trip_details = resources.TripDetailsResource(self)
self.trip_for_vehicle = resources.TripForVehicleResource(self)
self.report_problem_with_stop = resources.ReportProblemWithStopResource(self)
self.with_raw_response = OnebusawaySDKWithRawResponse(self)
self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self)

@@ -280,6 +282,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
trips_for_location: resources.AsyncTripsForLocationResource
trip_details: resources.AsyncTripDetailsResource
trip_for_vehicle: resources.AsyncTripForVehicleResource
report_problem_with_stop: resources.AsyncReportProblemWithStopResource
with_raw_response: AsyncOnebusawaySDKWithRawResponse
with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse

@@ -357,6 +360,7 @@ def __init__(
self.trips_for_location = resources.AsyncTripsForLocationResource(self)
self.trip_details = resources.AsyncTripDetailsResource(self)
self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self)
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self)
self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self)
self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self)

@@ -497,6 +501,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location)
self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details)
self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle)
self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse(
client.report_problem_with_stop
)


class AsyncOnebusawaySDKWithRawResponse:
@@ -525,6 +532,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location)
self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details)
self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle)
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse(
client.report_problem_with_stop
)


class OnebusawaySDKWithStreamedResponse:
@@ -555,6 +565,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location)
self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details)
self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle)
self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse(
client.report_problem_with_stop
)


class AsyncOnebusawaySDKWithStreamedResponse:
@@ -597,6 +610,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
)
self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details)
self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle)
self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse(
client.report_problem_with_stop
)


Client = OnebusawaySDK
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.13" # x-release-please-version
__version__ = "0.1.0-alpha.14" # 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
@@ -160,6 +160,14 @@
AgenciesWithCoverageResourceWithStreamingResponse,
AsyncAgenciesWithCoverageResourceWithStreamingResponse,
)
from .report_problem_with_stop import (
ReportProblemWithStopResource,
AsyncReportProblemWithStopResource,
ReportProblemWithStopResourceWithRawResponse,
AsyncReportProblemWithStopResourceWithRawResponse,
ReportProblemWithStopResourceWithStreamingResponse,
AsyncReportProblemWithStopResourceWithStreamingResponse,
)

__all__ = [
"AgenciesWithCoverageResource",
@@ -282,4 +290,10 @@
"AsyncTripForVehicleResourceWithRawResponse",
"TripForVehicleResourceWithStreamingResponse",
"AsyncTripForVehicleResourceWithStreamingResponse",
"ReportProblemWithStopResource",
"AsyncReportProblemWithStopResource",
"ReportProblemWithStopResourceWithRawResponse",
"AsyncReportProblemWithStopResourceWithRawResponse",
"ReportProblemWithStopResourceWithStreamingResponse",
"AsyncReportProblemWithStopResourceWithStreamingResponse",
]
206 changes: 206 additions & 0 deletions src/onebusaway/resources/report_problem_with_stop.py
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,
)
3 changes: 3 additions & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
@@ -43,3 +43,6 @@
from .agencies_with_coverage_retrieve_response import (
AgenciesWithCoverageRetrieveResponse as AgenciesWithCoverageRetrieveResponse,
)
from .report_problem_with_stop_retrieve_params import (
ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams,
)
26 changes: 26 additions & 0 deletions src/onebusaway/types/report_problem_with_stop_retrieve_params.py
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"""
122 changes: 122 additions & 0 deletions tests/api_resources/test_report_problem_with_stop.py
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="",
)

0 comments on commit bf43bf1

Please sign in to comment.