Skip to content

Commit

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

release: 0.1.0-alpha.17
  • Loading branch information
Ahmedhossamdev authored Aug 12, 2024
2 parents d0d0516 + 66adf29 commit dba3e8c
Show file tree
Hide file tree
Showing 17 changed files with 709 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.16"
".": "0.1.0-alpha.17"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 25
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-f0a1f65a327091207db6d5ecc22149149967274b0c54c192cc442f93cc819c64.yml
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.1.0-alpha.17 (2024-08-12)

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

### Features

* **api:** OpenAPI spec update via Stainless API ([#77](https://github.com/OneBusAway/python-sdk/issues/77)) ([70ce97c](https://github.com/OneBusAway/python-sdk/commit/70ce97c2c90dcfa6635fd36f83a7fb71a321ca69))
* **api:** update via SDK Studio ([#79](https://github.com/OneBusAway/python-sdk/issues/79)) ([b31341a](https://github.com/OneBusAway/python-sdk/commit/b31341a157b8b9aa554ad161afcbc581a041c3fb))

## 0.1.0-alpha.16 (2024-08-10)

Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.15...v0.1.0-alpha.16)
Expand Down
24 changes: 24 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,27 @@ from onebusaway.types import SearchForRouteRetrieveResponse
Methods:

- <code title="get /api/where/search/route.json">client.search_for_route.<a href="./src/onebusaway/resources/search_for_route.py">retrieve</a>(\*\*<a href="src/onebusaway/types/search_for_route_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/search_for_route_retrieve_response.py">SearchForRouteRetrieveResponse</a></code>

# Block

Types:

```python
from onebusaway.types import BlockRetrieveResponse
```

Methods:

- <code title="get /api/where/block/{blockID}.json">client.block.<a href="./src/onebusaway/resources/block.py">retrieve</a>(block_id) -> <a href="./src/onebusaway/types/block_retrieve_response.py">BlockRetrieveResponse</a></code>

# Shape

Types:

```python
from onebusaway.types import ShapeRetrieveResponse
```

Methods:

- <code title="get /api/where/shape/{shapeID}.json">client.shape.<a href="./src/onebusaway/resources/shape.py">retrieve</a>(shape_id) -> <a href="./src/onebusaway/types/shape_retrieve_response.py">ShapeRetrieveResponse</a></code>
21 changes: 21 additions & 0 deletions examples/block.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from helpers.load_env import load_settings

from onebusaway import OnebusawaySDK

# Load settings from .env file, if it exists. If not, we'll use the
# Puget Sound server URL (which is also the default in the SDK) and
# the 'TEST' API key.
settings = load_settings(
{
"api_key": "TEST",
"base_url": "https://api.pugetsound.onebusaway.org/",
}
)

# Create a new instance of the OneBusAway SDK with the settings we loaded.
oba = OnebusawaySDK(**settings)

block_id = '1_7310845'
response = oba.block.retrieve(block_id)
if response and response.data:
print(response.data.entry)
21 changes: 21 additions & 0 deletions examples/shape.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from helpers.load_env import load_settings

from onebusaway import OnebusawaySDK

# Load settings from .env file, if it exists. If not, we'll use the
# Puget Sound server URL (which is also the default in the SDK) and
# the 'TEST' API key.
settings = load_settings(
{
"api_key": "TEST",
"base_url": "https://api.pugetsound.onebusaway.org/",
}
)

# Create a new instance of the OneBusAway SDK with the settings we loaded.
oba = OnebusawaySDK(**settings)

shape_id = '1_10002005'
response = oba.shape.retrieve(shape_id)
if response and response.data:
print(response.data.entry)
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.16"
version = "0.1.0-alpha.17"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
16 changes: 16 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class OnebusawaySDK(SyncAPIClient):
report_problem_with_trip: resources.ReportProblemWithTripResource
search_for_stop: resources.SearchForStopResource
search_for_route: resources.SearchForRouteResource
block: resources.BlockResource
shape: resources.ShapeResource
with_raw_response: OnebusawaySDKWithRawResponse
with_streaming_response: OnebusawaySDKWithStreamedResponse

Expand Down Expand Up @@ -151,6 +153,8 @@ def __init__(
self.report_problem_with_trip = resources.ReportProblemWithTripResource(self)
self.search_for_stop = resources.SearchForStopResource(self)
self.search_for_route = resources.SearchForRouteResource(self)
self.block = resources.BlockResource(self)
self.shape = resources.ShapeResource(self)
self.with_raw_response = OnebusawaySDKWithRawResponse(self)
self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self)

Expand Down Expand Up @@ -292,6 +296,8 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
report_problem_with_trip: resources.AsyncReportProblemWithTripResource
search_for_stop: resources.AsyncSearchForStopResource
search_for_route: resources.AsyncSearchForRouteResource
block: resources.AsyncBlockResource
shape: resources.AsyncShapeResource
with_raw_response: AsyncOnebusawaySDKWithRawResponse
with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse

Expand Down Expand Up @@ -373,6 +379,8 @@ def __init__(
self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self)
self.search_for_stop = resources.AsyncSearchForStopResource(self)
self.search_for_route = resources.AsyncSearchForRouteResource(self)
self.block = resources.AsyncBlockResource(self)
self.shape = resources.AsyncShapeResource(self)
self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self)
self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self)

Expand Down Expand Up @@ -521,6 +529,8 @@ def __init__(self, client: OnebusawaySDK) -> None:
)
self.search_for_stop = resources.SearchForStopResourceWithRawResponse(client.search_for_stop)
self.search_for_route = resources.SearchForRouteResourceWithRawResponse(client.search_for_route)
self.block = resources.BlockResourceWithRawResponse(client.block)
self.shape = resources.ShapeResourceWithRawResponse(client.shape)


class AsyncOnebusawaySDKWithRawResponse:
Expand Down Expand Up @@ -557,6 +567,8 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
)
self.search_for_stop = resources.AsyncSearchForStopResourceWithRawResponse(client.search_for_stop)
self.search_for_route = resources.AsyncSearchForRouteResourceWithRawResponse(client.search_for_route)
self.block = resources.AsyncBlockResourceWithRawResponse(client.block)
self.shape = resources.AsyncShapeResourceWithRawResponse(client.shape)


class OnebusawaySDKWithStreamedResponse:
Expand Down Expand Up @@ -595,6 +607,8 @@ def __init__(self, client: OnebusawaySDK) -> None:
)
self.search_for_stop = resources.SearchForStopResourceWithStreamingResponse(client.search_for_stop)
self.search_for_route = resources.SearchForRouteResourceWithStreamingResponse(client.search_for_route)
self.block = resources.BlockResourceWithStreamingResponse(client.block)
self.shape = resources.ShapeResourceWithStreamingResponse(client.shape)


class AsyncOnebusawaySDKWithStreamedResponse:
Expand Down Expand Up @@ -645,6 +659,8 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
)
self.search_for_stop = resources.AsyncSearchForStopResourceWithStreamingResponse(client.search_for_stop)
self.search_for_route = resources.AsyncSearchForRouteResourceWithStreamingResponse(client.search_for_route)
self.block = resources.AsyncBlockResourceWithStreamingResponse(client.block)
self.shape = resources.AsyncShapeResourceWithStreamingResponse(client.shape)


Client = OnebusawaySDK
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.16" # x-release-please-version
__version__ = "0.1.0-alpha.17" # x-release-please-version
28 changes: 28 additions & 0 deletions src/onebusaway/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
TripResourceWithStreamingResponse,
AsyncTripResourceWithStreamingResponse,
)
from .block import (
BlockResource,
AsyncBlockResource,
BlockResourceWithRawResponse,
AsyncBlockResourceWithRawResponse,
BlockResourceWithStreamingResponse,
AsyncBlockResourceWithStreamingResponse,
)
from .route import (
RouteResource,
AsyncRouteResource,
Expand All @@ -24,6 +32,14 @@
RouteResourceWithStreamingResponse,
AsyncRouteResourceWithStreamingResponse,
)
from .shape import (
ShapeResource,
AsyncShapeResource,
ShapeResourceWithRawResponse,
AsyncShapeResourceWithRawResponse,
ShapeResourceWithStreamingResponse,
AsyncShapeResourceWithStreamingResponse,
)
from .agency import (
AgencyResource,
AsyncAgencyResource,
Expand Down Expand Up @@ -338,4 +354,16 @@
"AsyncSearchForRouteResourceWithRawResponse",
"SearchForRouteResourceWithStreamingResponse",
"AsyncSearchForRouteResourceWithStreamingResponse",
"BlockResource",
"AsyncBlockResource",
"BlockResourceWithRawResponse",
"AsyncBlockResourceWithRawResponse",
"BlockResourceWithStreamingResponse",
"AsyncBlockResourceWithStreamingResponse",
"ShapeResource",
"AsyncShapeResource",
"ShapeResourceWithRawResponse",
"AsyncShapeResourceWithRawResponse",
"ShapeResourceWithStreamingResponse",
"AsyncShapeResourceWithStreamingResponse",
]
141 changes: 141 additions & 0 deletions src/onebusaway/resources/block.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.block_retrieve_response import BlockRetrieveResponse

__all__ = ["BlockResource", "AsyncBlockResource"]


class BlockResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> BlockResourceWithRawResponse:
return BlockResourceWithRawResponse(self)

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

def retrieve(
self,
block_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,
) -> BlockRetrieveResponse:
"""
Get details of a specific block by 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 block_id:
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
return self._get(
f"/api/where/block/{block_id}.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BlockRetrieveResponse,
)


class AsyncBlockResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncBlockResourceWithRawResponse:
return AsyncBlockResourceWithRawResponse(self)

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

async def retrieve(
self,
block_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,
) -> BlockRetrieveResponse:
"""
Get details of a specific block by 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 block_id:
raise ValueError(f"Expected a non-empty value for `block_id` but received {block_id!r}")
return await self._get(
f"/api/where/block/{block_id}.json",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=BlockRetrieveResponse,
)


class BlockResourceWithRawResponse:
def __init__(self, block: BlockResource) -> None:
self._block = block

self.retrieve = to_raw_response_wrapper(
block.retrieve,
)


class AsyncBlockResourceWithRawResponse:
def __init__(self, block: AsyncBlockResource) -> None:
self._block = block

self.retrieve = async_to_raw_response_wrapper(
block.retrieve,
)


class BlockResourceWithStreamingResponse:
def __init__(self, block: BlockResource) -> None:
self._block = block

self.retrieve = to_streamed_response_wrapper(
block.retrieve,
)


class AsyncBlockResourceWithStreamingResponse:
def __init__(self, block: AsyncBlockResource) -> None:
self._block = block

self.retrieve = async_to_streamed_response_wrapper(
block.retrieve,
)
Loading

0 comments on commit dba3e8c

Please sign in to comment.