Skip to content

Commit

Permalink
feat(api): api update (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 23, 2024
1 parent bbae4cb commit 63efedb
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 201
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-6e3f74c1cfeef92447868eb9d50fb5bd703bd25191aa1c4583d659082e1adea7.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4bd84f4d9170653e443265bdf92c0520b008f613be5f60334e07b4151765e16a.yml
8 changes: 8 additions & 0 deletions src/increase/resources/oauth_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def retrieve(
def list(
self,
*,
created_at: oauth_application_list_params.CreatedAt | NotGiven = NOT_GIVEN,
cursor: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
status: oauth_application_list_params.Status | 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,
Expand Down Expand Up @@ -118,8 +120,10 @@ def list(
timeout=timeout,
query=maybe_transform(
{
"created_at": created_at,
"cursor": cursor,
"limit": limit,
"status": status,
},
oauth_application_list_params.OAuthApplicationListParams,
),
Expand Down Expand Up @@ -188,8 +192,10 @@ async def retrieve(
def list(
self,
*,
created_at: oauth_application_list_params.CreatedAt | NotGiven = NOT_GIVEN,
cursor: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
status: oauth_application_list_params.Status | 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,
Expand Down Expand Up @@ -224,8 +230,10 @@ def list(
timeout=timeout,
query=maybe_transform(
{
"created_at": created_at,
"cursor": cursor,
"limit": limit,
"status": status,
},
oauth_application_list_params.OAuthApplicationListParams,
),
Expand Down
51 changes: 49 additions & 2 deletions src/increase/types/oauth_application_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

from __future__ import annotations

from typing_extensions import TypedDict
from typing import List, Union
from datetime import datetime
from typing_extensions import Literal, Annotated, TypedDict

__all__ = ["OAuthApplicationListParams"]
from .._utils import PropertyInfo

__all__ = ["OAuthApplicationListParams", "CreatedAt", "Status"]


class OAuthApplicationListParams(TypedDict, total=False):
created_at: CreatedAt

cursor: str
"""Return the page of entries after this one."""

Expand All @@ -16,3 +22,44 @@ class OAuthApplicationListParams(TypedDict, total=False):
The default (and maximum) is 100 objects.
"""

status: Status


class CreatedAt(TypedDict, total=False):
after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
"""
Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
timestamp.
"""

before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
"""
Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
timestamp.
"""

on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
"""
Return results on or after this
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
"""

on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
"""
Return results on or before this
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
"""


_StatusReservedKeywords = TypedDict(
"_StatusReservedKeywords",
{
"in": List[Literal["active", "deleted"]],
},
total=False,
)


class Status(_StatusReservedKeywords, total=False):
pass
15 changes: 15 additions & 0 deletions tests/api_resources/test_oauth_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from increase import Increase, AsyncIncrease
from tests.utils import assert_matches_type
from increase.types import OAuthApplication
from increase._utils import parse_datetime
from increase.pagination import SyncPage, AsyncPage

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
Expand Down Expand Up @@ -64,8 +65,15 @@ def test_method_list(self, client: Increase) -> None:
@parametrize
def test_method_list_with_all_params(self, client: Increase) -> None:
oauth_application = client.oauth_applications.list(
created_at={
"after": parse_datetime("2019-12-27T18:11:19.117Z"),
"before": parse_datetime("2019-12-27T18:11:19.117Z"),
"on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"),
"on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"),
},
cursor="cursor",
limit=1,
status={"in": ["active"]},
)
assert_matches_type(SyncPage[OAuthApplication], oauth_application, path=["response"])

Expand Down Expand Up @@ -139,8 +147,15 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None:
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None:
oauth_application = await async_client.oauth_applications.list(
created_at={
"after": parse_datetime("2019-12-27T18:11:19.117Z"),
"before": parse_datetime("2019-12-27T18:11:19.117Z"),
"on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"),
"on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"),
},
cursor="cursor",
limit=1,
status={"in": ["active"]},
)
assert_matches_type(AsyncPage[OAuthApplication], oauth_application, path=["response"])

Expand Down

0 comments on commit 63efedb

Please sign in to comment.