Skip to content

Commit

Permalink
feat(api): api update (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 13, 2024
1 parent e1fb2c2 commit d46c628
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 5 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: 69
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-c6fdd52b428bc9889cb35fe70cafe8cc1a4cbee5c618ffa9ae811e781eeaf1c9.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-a671c20108a4aaebd22f105a7184bd9083b0cd8ba076f64a88c22498113be4af.yml
36 changes: 32 additions & 4 deletions src/structify/resources/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def get(
self,
*,
id: str,
resolve_id: bool | 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 All @@ -190,7 +191,13 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"id": id}, entity_get_params.EntityGetParams),
query=maybe_transform(
{
"id": id,
"resolve_id": resolve_id,
},
entity_get_params.EntityGetParams,
),
),
cast_to=EntityGetResponse,
)
Expand Down Expand Up @@ -528,6 +535,7 @@ def view(
self,
*,
id: str,
resolve_id: bool | 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 All @@ -552,7 +560,13 @@ def view(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"id": id}, entity_view_params.EntityViewParams),
query=maybe_transform(
{
"id": id,
"resolve_id": resolve_id,
},
entity_view_params.EntityViewParams,
),
),
cast_to=EntityViewResponse,
)
Expand Down Expand Up @@ -670,6 +684,7 @@ async def get(
self,
*,
id: str,
resolve_id: bool | 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 All @@ -696,7 +711,13 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform({"id": id}, entity_get_params.EntityGetParams),
query=await async_maybe_transform(
{
"id": id,
"resolve_id": resolve_id,
},
entity_get_params.EntityGetParams,
),
),
cast_to=EntityGetResponse,
)
Expand Down Expand Up @@ -1036,6 +1057,7 @@ async def view(
self,
*,
id: str,
resolve_id: bool | 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 All @@ -1060,7 +1082,13 @@ async def view(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform({"id": id}, entity_view_params.EntityViewParams),
query=await async_maybe_transform(
{
"id": id,
"resolve_id": resolve_id,
},
entity_view_params.EntityViewParams,
),
),
cast_to=EntityViewResponse,
)
Expand Down
2 changes: 2 additions & 0 deletions src/structify/types/entity_get_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

class EntityGetParams(TypedDict, total=False):
id: Required[str]

resolve_id: bool
2 changes: 2 additions & 0 deletions src/structify/types/entity_view_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

class EntityViewParams(TypedDict, total=False):
id: Required[str]

resolve_id: bool
32 changes: 32 additions & 0 deletions tests/api_resources/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ def test_method_get(self, client: Structify) -> None:
)
assert_matches_type(EntityGetResponse, entity, path=["response"])

@parametrize
def test_method_get_with_all_params(self, client: Structify) -> None:
entity = client.entities.get(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
resolve_id=True,
)
assert_matches_type(EntityGetResponse, entity, path=["response"])

@parametrize
def test_raw_response_get(self, client: Structify) -> None:
response = client.entities.with_raw_response.get(
Expand Down Expand Up @@ -500,6 +508,14 @@ def test_method_view(self, client: Structify) -> None:
)
assert_matches_type(EntityViewResponse, entity, path=["response"])

@parametrize
def test_method_view_with_all_params(self, client: Structify) -> None:
entity = client.entities.view(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
resolve_id=True,
)
assert_matches_type(EntityViewResponse, entity, path=["response"])

@parametrize
def test_raw_response_view(self, client: Structify) -> None:
response = client.entities.with_raw_response.view(
Expand Down Expand Up @@ -629,6 +645,14 @@ async def test_method_get(self, async_client: AsyncStructify) -> None:
)
assert_matches_type(EntityGetResponse, entity, path=["response"])

@parametrize
async def test_method_get_with_all_params(self, async_client: AsyncStructify) -> None:
entity = await async_client.entities.get(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
resolve_id=True,
)
assert_matches_type(EntityGetResponse, entity, path=["response"])

@parametrize
async def test_raw_response_get(self, async_client: AsyncStructify) -> None:
response = await async_client.entities.with_raw_response.get(
Expand Down Expand Up @@ -998,6 +1022,14 @@ async def test_method_view(self, async_client: AsyncStructify) -> None:
)
assert_matches_type(EntityViewResponse, entity, path=["response"])

@parametrize
async def test_method_view_with_all_params(self, async_client: AsyncStructify) -> None:
entity = await async_client.entities.view(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
resolve_id=True,
)
assert_matches_type(EntityViewResponse, entity, path=["response"])

@parametrize
async def test_raw_response_view(self, async_client: AsyncStructify) -> None:
response = await async_client.entities.with_raw_response.view(
Expand Down

0 comments on commit d46c628

Please sign in to comment.