Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.3"
".": "0.1.0-alpha.4"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.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.4 (2024-07-27)

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

### Features

* **api:** OpenAPI spec update via Stainless API ([#15](https://github.com/OneBusAway/python-sdk/issues/15)) ([171d1b7](https://github.com/OneBusAway/python-sdk/commit/171d1b79ca2cc120d315566f3f861c96a05d8a3b))

## 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)
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ 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>

# StopIDsForAgency

Types:

```python
from onebusaway.types import StopIDsForAgencyListResponse
```

Methods:

- <code title="get /api/where/stop-ids-for-agency/{agencyID}.json">client.stop_ids_for_agency.<a href="./src/onebusaway/resources/stop_ids_for_agency.py">list</a>(agency_id) -> <a href="./src/onebusaway/types/stop_ids_for_agency_list_response.py">StopIDsForAgencyListResponse</a></code>

# Route

Types:
Expand Down
16 changes: 16 additions & 0 deletions examples/stop_ids_for_agency.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")
agency_id = "40";
stop_ids = client.stop_ids_for_agency.list(agency_id)
if stop_ids.data:
for stop_id in stop_ids.data.list:
print(stop_id)


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.3"
version = "0.1.0-alpha.4"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
10 changes: 10 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class OnebusawaySDK(SyncAPIClient):
stops_for_location: resources.StopsForLocationResource
stops_for_route: resources.StopsForRouteResource
stop: resources.StopResource
stop_ids_for_agency: resources.StopIDsForAgencyResource
route: resources.RouteResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
Expand Down Expand Up @@ -123,6 +124,7 @@ def __init__(
self.stops_for_location = resources.StopsForLocationResource(self)
self.stops_for_route = resources.StopsForRouteResource(self)
self.stop = resources.StopResource(self)
self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self)
self.route = resources.RouteResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
Expand Down Expand Up @@ -253,6 +255,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
stops_for_location: resources.AsyncStopsForLocationResource
stops_for_route: resources.AsyncStopsForRouteResource
stop: resources.AsyncStopResource
stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource
route: resources.AsyncRouteResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
Expand Down Expand Up @@ -323,6 +326,7 @@ def __init__(
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
self.stop = resources.AsyncStopResource(self)
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self)
self.route = resources.AsyncRouteResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
Expand Down Expand Up @@ -456,6 +460,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
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.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
Expand All @@ -475,6 +480,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
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.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
Expand All @@ -496,6 +502,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
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.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency)
self.route = resources.RouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
Expand All @@ -519,6 +526,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop)
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse(
client.stop_ids_for_agency
)
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.3" # x-release-please-version
__version__ = "0.1.0-alpha.4" # 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
Expand Up @@ -88,6 +88,14 @@
TripsForLocationResourceWithStreamingResponse,
AsyncTripsForLocationResourceWithStreamingResponse,
)
from .stop_ids_for_agency import (
StopIDsForAgencyResource,
AsyncStopIDsForAgencyResource,
StopIDsForAgencyResourceWithRawResponse,
AsyncStopIDsForAgencyResourceWithRawResponse,
StopIDsForAgencyResourceWithStreamingResponse,
AsyncStopIDsForAgencyResourceWithStreamingResponse,
)
from .arrival_and_departure import (
ArrivalAndDepartureResource,
AsyncArrivalAndDepartureResource,
Expand Down Expand Up @@ -148,6 +156,12 @@
"AsyncStopResourceWithRawResponse",
"StopResourceWithStreamingResponse",
"AsyncStopResourceWithStreamingResponse",
"StopIDsForAgencyResource",
"AsyncStopIDsForAgencyResource",
"StopIDsForAgencyResourceWithRawResponse",
"AsyncStopIDsForAgencyResourceWithRawResponse",
"StopIDsForAgencyResourceWithStreamingResponse",
"AsyncStopIDsForAgencyResourceWithStreamingResponse",
"RouteResource",
"AsyncRouteResource",
"RouteResourceWithRawResponse",
Expand Down
141 changes: 141 additions & 0 deletions src/onebusaway/resources/stop_ids_for_agency.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_ids_for_agency_list_response import StopIDsForAgencyListResponse

__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"]


class StopIDsForAgencyResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse:
return StopIDsForAgencyResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingResponse:
return StopIDsForAgencyResourceWithStreamingResponse(self)

def list(
self,
agency_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,
) -> StopIDsForAgencyListResponse:
"""
Get stop IDs for a specific agency

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 agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return self._get(
f"/api/where/stop-ids-for-agency/{agency_id}.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=StopIDsForAgencyListResponse,
)


class AsyncStopIDsForAgencyResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse:
return AsyncStopIDsForAgencyResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingResponse:
return AsyncStopIDsForAgencyResourceWithStreamingResponse(self)

async def list(
self,
agency_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,
) -> StopIDsForAgencyListResponse:
"""
Get stop IDs for a specific agency

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 agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return await self._get(
f"/api/where/stop-ids-for-agency/{agency_id}.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=StopIDsForAgencyListResponse,
)


class StopIDsForAgencyResourceWithRawResponse:
def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
self._stop_ids_for_agency = stop_ids_for_agency

self.list = to_raw_response_wrapper(
stop_ids_for_agency.list,
)


class AsyncStopIDsForAgencyResourceWithRawResponse:
def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
self._stop_ids_for_agency = stop_ids_for_agency

self.list = async_to_raw_response_wrapper(
stop_ids_for_agency.list,
)


class StopIDsForAgencyResourceWithStreamingResponse:
def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
self._stop_ids_for_agency = stop_ids_for_agency

self.list = to_streamed_response_wrapper(
stop_ids_for_agency.list,
)


class AsyncStopIDsForAgencyResourceWithStreamingResponse:
def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
self._stop_ids_for_agency = stop_ids_for_agency

self.list = async_to_streamed_response_wrapper(
stop_ids_for_agency.list,
)
1 change: 1 addition & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse
from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams
from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams
from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse
from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams
from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse
from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams
Expand Down
23 changes: 23 additions & 0 deletions src/onebusaway/types/stop_ids_for_agency_list_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"]


class StopIDsForAgencyListResponseData(BaseModel):
list: List[str]

references: References

limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None)


class StopIDsForAgencyListResponse(ResponseWrapper):
data: Optional[StopIDsForAgencyListResponseData] = None
Loading