Skip to content

Commit

Permalink
release: 0.1.0-alpha.2 (#5)
Browse files Browse the repository at this point in the history
Automated Release PR
---


## 0.1.0-alpha.2 (2024-06-10)

Full Changelog:
[v0.1.0-alpha.1...v0.1.0-alpha.2](v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** update via SDK Studio
([#4](#4))
([17b7ce5](17b7ce5))

---
This Pull Request has been generated automatically as part of
[Stainless](https://stainlessapi.com/)'s release process.
For a better experience, it is recommended to use either rebase-merge or
squash-merge when merging this pull request ([see
details](https://github.com/stainless-api/release-please/#linear-git-commit-history-use-squash-merge)).

_More technical details can be found at
[stainless-api/release-please](https://github.com/stainless-api/release-please)_.

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
  • Loading branch information
stainless-app[bot] authored Jun 10, 2024
1 parent 379e17f commit 16c3a93
Show file tree
Hide file tree
Showing 38 changed files with 423 additions and 428 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.1"
".": "0.1.0-alpha.2"
}
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.2 (2024-06-10)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/Metronome-Industries/metronome-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** update via SDK Studio ([#4](https://github.com/Metronome-Industries/metronome-python/issues/4)) ([17b7ce5](https://github.com/Metronome-Industries/metronome-python/commit/17b7ce57f0c3eb6310ccce51501c84b3e117c4c4))

## 0.1.0-alpha.1 (2024-06-10)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/Metronome-Industries/metronome-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
36 changes: 15 additions & 21 deletions api.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "metronome-sdk"
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
description = "The official Python library for the metronome API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/metronome/_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__ = "metronome"
__version__ = "0.1.0-alpha.1" # x-release-please-version
__version__ = "0.1.0-alpha.2" # x-release-please-version
54 changes: 54 additions & 0 deletions src/metronome/pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Generic, TypeVar, Optional
from typing_extensions import override

from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage

__all__ = ["SyncCursorPage", "AsyncCursorPage"]

_T = TypeVar("_T")


class SyncCursorPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
next_page: Optional[str] = None
"""Cursor to fetch the next page"""
data: List[_T]
"""Items of the page"""

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
return []
return data

@override
def next_page_info(self) -> Optional[PageInfo]:
next_page = self.next_page
if not next_page:
return None

return PageInfo(params={"next_page": next_page})


class AsyncCursorPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
next_page: Optional[str] = None
"""Cursor to fetch the next page"""
data: List[_T]
"""Items of the page"""

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
return []
return data

@override
def next_page_info(self) -> Optional[PageInfo]:
next_page = self.next_page
if not next_page:
return None

return PageInfo(params={"next_page": next_page})
25 changes: 13 additions & 12 deletions src/metronome/resources/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

from ..types import audit_log_list_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
async_maybe_transform,
)
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand All @@ -22,7 +19,9 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..pagination import SyncCursorPage, AsyncCursorPage
from .._base_client import (
AsyncPaginator,
make_request_options,
)
from ..types.audit_log_list_response import AuditLogListResponse
Expand Down Expand Up @@ -55,7 +54,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AuditLogListResponse:
) -> SyncCursorPage[AuditLogListResponse]:
"""Retrieves a range of audit logs.
If no further audit logs are currently
Expand Down Expand Up @@ -89,8 +88,9 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get(
return self._get_api_list(
"/auditLogs",
page=SyncCursorPage[AuditLogListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -109,7 +109,7 @@ def list(
audit_log_list_params.AuditLogListParams,
),
),
cast_to=AuditLogListResponse,
model=AuditLogListResponse,
)


Expand All @@ -122,7 +122,7 @@ def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse:
def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse:
return AsyncAuditLogsResourceWithStreamingResponse(self)

async def list(
def list(
self,
*,
ending_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
Expand All @@ -138,7 +138,7 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AuditLogListResponse:
) -> AsyncPaginator[AuditLogListResponse, AsyncCursorPage[AuditLogListResponse]]:
"""Retrieves a range of audit logs.
If no further audit logs are currently
Expand Down Expand Up @@ -172,14 +172,15 @@ async def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._get(
return self._get_api_list(
"/auditLogs",
page=AsyncCursorPage[AuditLogListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
query=maybe_transform(
{
"ending_before": ending_before,
"limit": limit,
Expand All @@ -192,7 +193,7 @@ async def list(
audit_log_list_params.AuditLogListParams,
),
),
cast_to=AuditLogListResponse,
model=AuditLogListResponse,
)


Expand Down
20 changes: 12 additions & 8 deletions src/metronome/resources/billable_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..pagination import SyncCursorPage, AsyncCursorPage
from .._base_client import (
AsyncPaginator,
make_request_options,
)
from ..types.billable_metric_list_response import BillableMetricListResponse
Expand Down Expand Up @@ -175,7 +177,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BillableMetricListResponse:
) -> SyncCursorPage[BillableMetricListResponse]:
"""
List all billable metrics.
Expand All @@ -197,8 +199,9 @@ def list(
"""
if not customer_id:
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
return self._get(
return self._get_api_list(
f"/customers/{customer_id}/billable-metrics",
page=SyncCursorPage[BillableMetricListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -213,7 +216,7 @@ def list(
billable_metric_list_params.BillableMetricListParams,
),
),
cast_to=BillableMetricListResponse,
model=BillableMetricListResponse,
)

def archive(
Expand Down Expand Up @@ -375,7 +378,7 @@ async def retrieve(
cast_to=BillableMetricRetrieveResponse,
)

async def list(
def list(
self,
customer_id: str,
*,
Expand All @@ -388,7 +391,7 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BillableMetricListResponse:
) -> AsyncPaginator[BillableMetricListResponse, AsyncCursorPage[BillableMetricListResponse]]:
"""
List all billable metrics.
Expand All @@ -410,14 +413,15 @@ async def list(
"""
if not customer_id:
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
return await self._get(
return self._get_api_list(
f"/customers/{customer_id}/billable-metrics",
page=AsyncCursorPage[BillableMetricListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
query=maybe_transform(
{
"limit": limit,
"next_page": next_page,
Expand All @@ -426,7 +430,7 @@ async def list(
billable_metric_list_params.BillableMetricListParams,
),
),
cast_to=BillableMetricListResponse,
model=BillableMetricListResponse,
)

async def archive(
Expand Down
Loading

0 comments on commit 16c3a93

Please sign in to comment.