Skip to content

Commit 5b07224

Browse files
feat(api): aggregated API specs update
1 parent 66aedc4 commit 5b07224

4 files changed

Lines changed: 32 additions & 38 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 657
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d7bc6f6b1d020fb7c24b6f53d9437256eee2203d0aa46c7337f620c9630285f8.yml
3-
openapi_spec_hash: 7922ec4e12c6c73c57cb98dbfee69234
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-236958943262c124215347d9b33e2de06e1e38e4b89797eddb0a73fb29ff6d62.yml
3+
openapi_spec_hash: fbe0b6ef8b425ff72e84ef8f3514771d
44
config_hash: aa5a9dd05b6324fcb454d0694e5901a3

src/gcore/resources/iam/users.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ def update(
5353
self,
5454
user_id: int,
5555
*,
56-
auth_types: List[AuthType],
57-
email: str,
58-
lang: UserLanguage,
59-
name: Optional[str],
60-
phone: Optional[str],
56+
auth_types: List[AuthType] | Omit = omit,
57+
email: str | Omit = omit,
58+
lang: UserLanguage | Omit = omit,
59+
name: Optional[str] | Omit = omit,
60+
phone: Optional[str] | Omit = omit,
6161
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6262
# The extra values given here take precedence over values defined on the client or passed to this method.
6363
extra_headers: Headers | None = None,
@@ -310,11 +310,11 @@ async def update(
310310
self,
311311
user_id: int,
312312
*,
313-
auth_types: List[AuthType],
314-
email: str,
315-
lang: UserLanguage,
316-
name: Optional[str],
317-
phone: Optional[str],
313+
auth_types: List[AuthType] | Omit = omit,
314+
email: str | Omit = omit,
315+
lang: UserLanguage | Omit = omit,
316+
name: Optional[str] | Omit = omit,
317+
phone: Optional[str] | Omit = omit,
318318
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
319319
# The extra values given here take precedence over values defined on the client or passed to this method.
320320
extra_headers: Headers | None = None,

src/gcore/types/iam/user_update_params.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import List, Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import TypedDict
77

88
from .auth_type import AuthType
99
from .user_language import UserLanguage
@@ -12,20 +12,20 @@
1212

1313

1414
class UserUpdateParams(TypedDict, total=False):
15-
auth_types: Required[List[AuthType]]
15+
auth_types: List[AuthType]
1616
"""System field. List of auth types available for the account."""
1717

18-
email: Required[str]
18+
email: str
1919
"""User's email address."""
2020

21-
lang: Required[UserLanguage]
21+
lang: UserLanguage
2222
"""User's language.
2323
2424
Defines language of the control panel and email messages.
2525
"""
2626

27-
name: Required[Optional[str]]
27+
name: Optional[str]
2828
"""User's name."""
2929

30-
phone: Required[Optional[str]]
30+
phone: Optional[str]
3131
"""User's phone."""

tests/api_resources/iam/test_users.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ class TestUsers:
2525
@pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields")
2626
@parametrize
2727
def test_method_update(self, client: Gcore) -> None:
28+
user = client.iam.users.update(
29+
user_id=0,
30+
)
31+
assert_matches_type(User, user, path=["response"])
32+
33+
@parametrize
34+
def test_method_update_with_all_params(self, client: Gcore) -> None:
2835
user = client.iam.users.update(
2936
user_id=0,
3037
auth_types=["password"],
@@ -40,11 +47,6 @@ def test_method_update(self, client: Gcore) -> None:
4047
def test_raw_response_update(self, client: Gcore) -> None:
4148
response = client.iam.users.with_raw_response.update(
4249
user_id=0,
43-
auth_types=["password"],
44-
email="dev@stainless.com",
45-
lang="de",
46-
name="name",
47-
phone="phone",
4850
)
4951

5052
assert response.is_closed is True
@@ -57,11 +59,6 @@ def test_raw_response_update(self, client: Gcore) -> None:
5759
def test_streaming_response_update(self, client: Gcore) -> None:
5860
with client.iam.users.with_streaming_response.update(
5961
user_id=0,
60-
auth_types=["password"],
61-
email="dev@stainless.com",
62-
lang="de",
63-
name="name",
64-
phone="phone",
6562
) as response:
6663
assert not response.is_closed
6764
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -233,6 +230,13 @@ class TestAsyncUsers:
233230
@pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields")
234231
@parametrize
235232
async def test_method_update(self, async_client: AsyncGcore) -> None:
233+
user = await async_client.iam.users.update(
234+
user_id=0,
235+
)
236+
assert_matches_type(User, user, path=["response"])
237+
238+
@parametrize
239+
async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None:
236240
user = await async_client.iam.users.update(
237241
user_id=0,
238242
auth_types=["password"],
@@ -248,11 +252,6 @@ async def test_method_update(self, async_client: AsyncGcore) -> None:
248252
async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
249253
response = await async_client.iam.users.with_raw_response.update(
250254
user_id=0,
251-
auth_types=["password"],
252-
email="dev@stainless.com",
253-
lang="de",
254-
name="name",
255-
phone="phone",
256255
)
257256

258257
assert response.is_closed is True
@@ -265,11 +264,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
265264
async def test_streaming_response_update(self, async_client: AsyncGcore) -> None:
266265
async with async_client.iam.users.with_streaming_response.update(
267266
user_id=0,
268-
auth_types=["password"],
269-
email="dev@stainless.com",
270-
lang="de",
271-
name="name",
272-
phone="phone",
273267
) as response:
274268
assert not response.is_closed
275269
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

0 commit comments

Comments
 (0)