Skip to content

Commit e4f64fd

Browse files
feat(api): aggregated API specs update
1 parent b3485b6 commit e4f64fd

4 files changed

Lines changed: 41 additions & 110 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: 645
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml
3-
openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ade61b5f8b94d9aaf24c2770f59a72e498afde0922d4967f51a5265d7848332a.yml
3+
openapi_spec_hash: fd4ff75b24c8f9ddf0de165a37253859
44
config_hash: 72dafc786d92b98aa097fd4ec34680ca

src/gcore/resources/iam/users.py

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable, Optional
5+
from typing import List, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -52,13 +52,11 @@ def update(
5252
self,
5353
user_id: int,
5454
*,
55-
auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit,
56-
company: str | Omit = omit,
57-
email: str | Omit = omit,
58-
groups: Iterable[user_update_params.Group] | Omit = omit,
59-
lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit,
60-
name: Optional[str] | Omit = omit,
61-
phone: Optional[str] | Omit = omit,
55+
auth_types: List[Literal["password", "sso", "github", "google-oauth2"]],
56+
email: str,
57+
lang: Literal["de", "en", "ru", "zh", "az"],
58+
name: Optional[str],
59+
phone: Optional[str],
6260
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6361
# The extra values given here take precedence over values defined on the client or passed to this method.
6462
extra_headers: Headers | None = None,
@@ -73,20 +71,8 @@ def update(
7371
7472
List of auth types available for the account.
7573
76-
company: User's company.
77-
7874
email: User's email address.
7975
80-
groups: User's group in the current account.
81-
82-
IAM supports 5 groups:
83-
84-
- Users
85-
- Administrators
86-
- Engineers
87-
- Purge and Prefetch only (API)
88-
- Purge and Prefetch only (API+Web)
89-
9076
lang: User's language.
9177
9278
Defines language of the control panel and email messages.
@@ -108,9 +94,7 @@ def update(
10894
body=maybe_transform(
10995
{
11096
"auth_types": auth_types,
111-
"company": company,
11297
"email": email,
113-
"groups": groups,
11498
"lang": lang,
11599
"name": name,
116100
"phone": phone,
@@ -325,13 +309,11 @@ async def update(
325309
self,
326310
user_id: int,
327311
*,
328-
auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit,
329-
company: str | Omit = omit,
330-
email: str | Omit = omit,
331-
groups: Iterable[user_update_params.Group] | Omit = omit,
332-
lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit,
333-
name: Optional[str] | Omit = omit,
334-
phone: Optional[str] | Omit = omit,
312+
auth_types: List[Literal["password", "sso", "github", "google-oauth2"]],
313+
email: str,
314+
lang: Literal["de", "en", "ru", "zh", "az"],
315+
name: Optional[str],
316+
phone: Optional[str],
335317
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
336318
# The extra values given here take precedence over values defined on the client or passed to this method.
337319
extra_headers: Headers | None = None,
@@ -346,20 +328,8 @@ async def update(
346328
347329
List of auth types available for the account.
348330
349-
company: User's company.
350-
351331
email: User's email address.
352332
353-
groups: User's group in the current account.
354-
355-
IAM supports 5 groups:
356-
357-
- Users
358-
- Administrators
359-
- Engineers
360-
- Purge and Prefetch only (API)
361-
- Purge and Prefetch only (API+Web)
362-
363333
lang: User's language.
364334
365335
Defines language of the control panel and email messages.
@@ -381,9 +351,7 @@ async def update(
381351
body=await async_maybe_transform(
382352
{
383353
"auth_types": auth_types,
384-
"company": company,
385354
"email": email,
386-
"groups": groups,
387355
"lang": lang,
388356
"name": name,
389357
"phone": phone,

src/gcore/types/iam/user_update_params.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,27 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Iterable, Optional
6-
from typing_extensions import Literal, TypedDict
5+
from typing import List, Optional
6+
from typing_extensions import Literal, Required, TypedDict
77

8-
__all__ = ["UserUpdateParams", "Group"]
8+
__all__ = ["UserUpdateParams"]
99

1010

1111
class UserUpdateParams(TypedDict, total=False):
12-
auth_types: List[Literal["password", "sso", "github", "google-oauth2"]]
12+
auth_types: Required[List[Literal["password", "sso", "github", "google-oauth2"]]]
1313
"""System field. List of auth types available for the account."""
1414

15-
company: str
16-
"""User's company."""
17-
18-
email: str
15+
email: Required[str]
1916
"""User's email address."""
2017

21-
groups: Iterable[Group]
22-
"""User's group in the current account.
23-
24-
IAM supports 5 groups:
25-
26-
- Users
27-
- Administrators
28-
- Engineers
29-
- Purge and Prefetch only (API)
30-
- Purge and Prefetch only (API+Web)
31-
"""
32-
33-
lang: Literal["de", "en", "ru", "zh", "az"]
18+
lang: Required[Literal["de", "en", "ru", "zh", "az"]]
3419
"""User's language.
3520
3621
Defines language of the control panel and email messages.
3722
"""
3823

39-
name: Optional[str]
24+
name: Required[Optional[str]]
4025
"""User's name."""
4126

42-
phone: Optional[str]
27+
phone: Required[Optional[str]]
4328
"""User's phone."""
44-
45-
46-
class Group(TypedDict, total=False):
47-
id: int
48-
"""Group's ID: Possible values are:
49-
50-
- 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
51-
(API+Web)* 3022 - Purge and Prefetch only (API)
52-
"""
53-
54-
name: Literal[
55-
"Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)"
56-
]
57-
"""Group's name."""

tests/api_resources/iam/test_users.py

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,10 @@ class TestUsers:
2525

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(UserUpdated, user, path=["response"])
32-
33-
@parametrize
34-
def test_method_update_with_all_params(self, client: Gcore) -> None:
3528
user = client.iam.users.update(
3629
user_id=0,
3730
auth_types=["password"],
38-
company="company",
3931
email="dev@stainless.com",
40-
groups=[
41-
{
42-
"id": 1,
43-
"name": "Administrators",
44-
}
45-
],
4632
lang="de",
4733
name="name",
4834
phone="phone",
@@ -53,6 +39,11 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
5339
def test_raw_response_update(self, client: Gcore) -> None:
5440
response = client.iam.users.with_raw_response.update(
5541
user_id=0,
42+
auth_types=["password"],
43+
email="dev@stainless.com",
44+
lang="de",
45+
name="name",
46+
phone="phone",
5647
)
5748

5849
assert response.is_closed is True
@@ -64,6 +55,11 @@ def test_raw_response_update(self, client: Gcore) -> None:
6455
def test_streaming_response_update(self, client: Gcore) -> None:
6556
with client.iam.users.with_streaming_response.update(
6657
user_id=0,
58+
auth_types=["password"],
59+
email="dev@stainless.com",
60+
lang="de",
61+
name="name",
62+
phone="phone",
6763
) as response:
6864
assert not response.is_closed
6965
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -230,24 +226,10 @@ class TestAsyncUsers:
230226

231227
@parametrize
232228
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(UserUpdated, user, path=["response"])
237-
238-
@parametrize
239-
async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None:
240229
user = await async_client.iam.users.update(
241230
user_id=0,
242231
auth_types=["password"],
243-
company="company",
244232
email="dev@stainless.com",
245-
groups=[
246-
{
247-
"id": 1,
248-
"name": "Administrators",
249-
}
250-
],
251233
lang="de",
252234
name="name",
253235
phone="phone",
@@ -258,6 +240,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
258240
async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
259241
response = await async_client.iam.users.with_raw_response.update(
260242
user_id=0,
243+
auth_types=["password"],
244+
email="dev@stainless.com",
245+
lang="de",
246+
name="name",
247+
phone="phone",
261248
)
262249

263250
assert response.is_closed is True
@@ -269,6 +256,11 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
269256
async def test_streaming_response_update(self, async_client: AsyncGcore) -> None:
270257
async with async_client.iam.users.with_streaming_response.update(
271258
user_id=0,
259+
auth_types=["password"],
260+
email="dev@stainless.com",
261+
lang="de",
262+
name="name",
263+
phone="phone",
272264
) as response:
273265
assert not response.is_closed
274266
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

0 commit comments

Comments
 (0)