Skip to content

Commit

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

release: 0.1.0-alpha.3
  • Loading branch information
Ahmedhossamdev authored Jul 27, 2024
2 parents bb4d4a6 + f54ca0a commit 7c0ef70
Show file tree
Hide file tree
Showing 15 changed files with 357 additions and 19 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.2"
".": "0.1.0-alpha.3"
}
4 changes: 2 additions & 2 deletions .stats.yml
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-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.1.0-alpha.3 (2024-07-27)

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

### Features

* **api:** OpenAPI spec update via Stainless API ([#10](https://github.com/OneBusAway/python-sdk/issues/10)) ([72b1a9c](https://github.com/OneBusAway/python-sdk/commit/72b1a9cead47f18491e1119a836088e20bb0d5f4))


### Chores

* **internal:** refactor release doctor script ([#12](https://github.com/OneBusAway/python-sdk/issues/12)) ([ee1f10f](https://github.com/OneBusAway/python-sdk/commit/ee1f10fc42fbda4a4df01d58636d5b6c8209fc70))
* **tests:** update prism version ([#13](https://github.com/OneBusAway/python-sdk/issues/13)) ([4298ff4](https://github.com/OneBusAway/python-sdk/commit/4298ff401d952e2ed17674b59001bb5d1146ae6d))

## 0.1.0-alpha.2 (2024-07-22)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ Methods:

- <code title="get /api/where/stops-for-route/{routeID}.json">client.stops_for_route.<a href="./src/onebusaway/resources/stops_for_route.py">list</a>(route_id, \*\*<a href="src/onebusaway/types/stops_for_route_list_params.py">params</a>) -> <a href="./src/onebusaway/types/stops_for_route_list_response.py">StopsForRouteListResponse</a></code>

# Stop

Types:

```python
from onebusaway.types import StopRetrieveResponse
```

Methods:

- <code title="get /api/where/stop/{stopID}.json">client.stop.<a href="./src/onebusaway/resources/stop.py">retrieve</a>(stop_id) -> <a href="./src/onebusaway/types/stop_retrieve_response.py">StopRetrieveResponse</a></code>

# Route

Types:
Expand Down
13 changes: 1 addition & 12 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
#!/usr/bin/env bash

warnings=()
errors=()

if [ -z "${PYPI_TOKEN}" ]; then
warnings+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenWarnings=${#warnings[@]}

if [[ lenWarnings -gt 0 ]]; then
echo -e "Found the following warnings in the release environment:\n"

for warning in "${warnings[@]}"; do
echo -e "- $warning\n"
done
errors+=("The ONEBUSAWAY_SDK_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}
Expand Down
16 changes: 16 additions & 0 deletions examples/stop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


import onebusaway


def main_sync() -> None:
client = onebusaway.OnebusawaySDK(api_key="TEST")
stop = client.stop.retrieve("1_75403")

if stop.data and stop.data.entry:
print(stop.data.entry)
else:
print("stop not found")

if __name__ == "__main__":
main_sync()
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.2"
version = "0.1.0-alpha.3"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"

# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL" &> .prism.log &

# Wait for server to come online
echo -n "Waiting for server"
Expand All @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL"
fi
8 changes: 8 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class OnebusawaySDK(SyncAPIClient):
current_time: resources.CurrentTimeResource
stops_for_location: resources.StopsForLocationResource
stops_for_route: resources.StopsForRouteResource
stop: resources.StopResource
route: resources.RouteResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
Expand Down Expand Up @@ -121,6 +122,7 @@ def __init__(
self.current_time = resources.CurrentTimeResource(self)
self.stops_for_location = resources.StopsForLocationResource(self)
self.stops_for_route = resources.StopsForRouteResource(self)
self.stop = resources.StopResource(self)
self.route = resources.RouteResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
Expand Down Expand Up @@ -250,6 +252,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
current_time: resources.AsyncCurrentTimeResource
stops_for_location: resources.AsyncStopsForLocationResource
stops_for_route: resources.AsyncStopsForRouteResource
stop: resources.AsyncStopResource
route: resources.AsyncRouteResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
Expand Down Expand Up @@ -319,6 +322,7 @@ def __init__(
self.current_time = resources.AsyncCurrentTimeResource(self)
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
self.stop = resources.AsyncStopResource(self)
self.route = resources.AsyncRouteResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
Expand Down Expand Up @@ -451,6 +455,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.StopResourceWithRawResponse(client.stop)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
Expand All @@ -469,6 +474,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
Expand All @@ -489,6 +495,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
self.route = resources.RouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand All @@ -511,6 +518,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
client.stops_for_location
)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop)
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand Down
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.2" # x-release-please-version
__version__ = "0.1.0-alpha.3" # 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
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .stop import (
StopResource,
AsyncStopResource,
StopResourceWithRawResponse,
AsyncStopResourceWithRawResponse,
StopResourceWithStreamingResponse,
AsyncStopResourceWithStreamingResponse,
)
from .trip import (
TripResource,
AsyncTripResource,
Expand Down Expand Up @@ -134,6 +142,12 @@
"AsyncStopsForRouteResourceWithRawResponse",
"StopsForRouteResourceWithStreamingResponse",
"AsyncStopsForRouteResourceWithStreamingResponse",
"StopResource",
"AsyncStopResource",
"StopResourceWithRawResponse",
"AsyncStopResourceWithRawResponse",
"StopResourceWithStreamingResponse",
"AsyncStopResourceWithStreamingResponse",
"RouteResource",
"AsyncRouteResource",
"RouteResourceWithRawResponse",
Expand Down
141 changes: 141 additions & 0 deletions src/onebusaway/resources/stop.py
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:
"""
Get details of a specific stop
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/{stop_id}.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:
"""
Get details of a specific stop
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/{stop_id}.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,
)
1 change: 1 addition & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from .shared import References as References, ResponseWrapper as ResponseWrapper
from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse
from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse
from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse
from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse
Expand Down
Loading

0 comments on commit 7c0ef70

Please sign in to comment.