Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit b7cd7fb

Browse files
authored
Update generated code (#37)
1 parent 88f5ee1 commit b7cd7fb

File tree

6 files changed

+129
-25
lines changed

6 files changed

+129
-25
lines changed

src/userhub_sdk/_internal/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
API_BASE_URL = "https://api.userhub.com"
77
API_VERSION = "2025-05-01"
8-
USER_AGENT = "UserHub-Python/0.8.0"
9-
VERSION = "0.8.0"
8+
USER_AGENT = "UserHub-Python/0.8.1"
9+
VERSION = "0.8.1"
1010

1111
AUTH_HEADER = "Authorization"
1212
API_KEY_HEADER = "UserHub-Api-Key"

src/userhub_sdk/adminapi/_users.py

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def import_account(
573573
574574
This must be in the format `<externalId>@<connectionId>` where
575575
`externalId` is the identity provider user identifier and
576-
and `connectionId` is the User Provider connection identifier.
576+
and `connectionId` is the User provider connection identifier.
577577
"""
578578
req = Request(
579579
"admin.users.importAccount",
@@ -590,6 +590,53 @@ def import_account(
590590

591591
return res.decode_body(adminv1.User.__json_decode__)
592592

593+
def report_action(
594+
self,
595+
user_id: str,
596+
*,
597+
action: str,
598+
wait: Optional[bool] = None,
599+
) -> adminv1.ReportUserActionResponse:
600+
"""
601+
Report a user action.
602+
603+
If the `<externalId>@<connectionId>` user identifier syntax is
604+
used and the user doesn't exist, they will be imported.
605+
606+
By default, the action is processed asynchronously.
607+
608+
:param user_id:
609+
The identifier of the user.
610+
611+
This can be in the format `<externalId>@<connectionId>` where
612+
`externalId` is the identity provider user identifier and
613+
and `connectionId` is the User provider connection identifier.
614+
:param action:
615+
The type of action.
616+
:param wait:
617+
Process the user action synchronously.
618+
619+
Otherwise the action is processed in the background and errors
620+
won't be returned.
621+
"""
622+
req = Request(
623+
"admin.users.reportAction",
624+
"POST",
625+
f"/admin/v1/users/{util.quote_path(user_id)}:reportAction",
626+
)
627+
body: Dict[str, Any] = {}
628+
629+
if action:
630+
body["action"] = action
631+
if wait:
632+
body["wait"] = wait
633+
634+
req.set_body(body)
635+
636+
res = self._transport.execute(req)
637+
638+
return res.decode_body(adminv1.ReportUserActionResponse.__json_decode__)
639+
593640
def create_api_session(
594641
self,
595642
user_id: str,
@@ -631,7 +678,7 @@ def create_portal_session(
631678
The user ID.
632679
633680
In addition to supporting the UserHub user ID,
634-
you can also pass in the User Provider external identifier in the
681+
you can also pass in the User provider external identifier in the
635682
format `<externalId>@<connectionId>` and if the user doesn't
636683
exist in UserHub they will automatically be imported.
637684
:param portal_url:
@@ -1257,7 +1304,7 @@ async def import_account(
12571304
12581305
This must be in the format `<externalId>@<connectionId>` where
12591306
`externalId` is the identity provider user identifier and
1260-
and `connectionId` is the User Provider connection identifier.
1307+
and `connectionId` is the User provider connection identifier.
12611308
"""
12621309
req = Request(
12631310
"admin.users.importAccount",
@@ -1274,6 +1321,53 @@ async def import_account(
12741321

12751322
return res.decode_body(adminv1.User.__json_decode__)
12761323

1324+
async def report_action(
1325+
self,
1326+
user_id: str,
1327+
*,
1328+
action: str,
1329+
wait: Optional[bool] = None,
1330+
) -> adminv1.ReportUserActionResponse:
1331+
"""
1332+
Report a user action.
1333+
1334+
If the `<externalId>@<connectionId>` user identifier syntax is
1335+
used and the user doesn't exist, they will be imported.
1336+
1337+
By default, the action is processed asynchronously.
1338+
1339+
:param user_id:
1340+
The identifier of the user.
1341+
1342+
This can be in the format `<externalId>@<connectionId>` where
1343+
`externalId` is the identity provider user identifier and
1344+
and `connectionId` is the User provider connection identifier.
1345+
:param action:
1346+
The type of action.
1347+
:param wait:
1348+
Process the user action synchronously.
1349+
1350+
Otherwise the action is processed in the background and errors
1351+
won't be returned.
1352+
"""
1353+
req = Request(
1354+
"admin.users.reportAction",
1355+
"POST",
1356+
f"/admin/v1/users/{util.quote_path(user_id)}:reportAction",
1357+
)
1358+
body: Dict[str, Any] = {}
1359+
1360+
if action:
1361+
body["action"] = action
1362+
if wait:
1363+
body["wait"] = wait
1364+
1365+
req.set_body(body)
1366+
1367+
res = await self._transport.execute(req)
1368+
1369+
return res.decode_body(adminv1.ReportUserActionResponse.__json_decode__)
1370+
12771371
async def create_api_session(
12781372
self,
12791373
user_id: str,
@@ -1315,7 +1409,7 @@ async def create_portal_session(
13151409
The user ID.
13161410
13171411
In addition to supporting the UserHub user ID,
1318-
you can also pass in the User Provider external identifier in the
1412+
you can also pass in the User provider external identifier in the
13191413
format `<externalId>@<connectionId>` and if the user doesn't
13201414
exist in UserHub they will automatically be imported.
13211415
:param portal_url:

src/userhub_sdk/adminv1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from ._product_connection import ProductConnection
6868
from ._purge_organization_response import PurgeOrganizationResponse
6969
from ._purge_user_response import PurgeUserResponse
70+
from ._report_user_action_response import ReportUserActionResponse
7071
from ._role import Role
7172
from ._signing_secret import SigningSecret
7273
from ._signup_flow import SignupFlow
@@ -149,6 +150,7 @@
149150
"ProductConnection",
150151
"PurgeOrganizationResponse",
151152
"PurgeUserResponse",
153+
"ReportUserActionResponse",
152154
"Role",
153155
"SigningSecret",
154156
"SignupFlow",
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Code generated. DO NOT EDIT.
22

33
import dataclasses
4-
from typing import Any, Dict, List
4+
from typing import Any, Dict
55

66

77
@dataclasses.dataclass
@@ -10,15 +10,9 @@ class BuiltinEmailConnection:
1010
The builtin email specific connection data.
1111
"""
1212

13-
#: The allowed email list.
14-
allowed_emails: List[str] = dataclasses.field(default_factory=list)
15-
1613
def __json_encode__(self) -> Dict[str, Any]:
1714
data: Dict[str, Any] = {}
1815

19-
if self.allowed_emails is not None:
20-
data["allowedEmails"] = self.allowed_emails
21-
2216
return data
2317

2418
@staticmethod
@@ -28,7 +22,4 @@ def __json_decode__(data: Dict[str, Any]) -> "BuiltinEmailConnection":
2822

2923
kwargs: Dict[str, Any] = {}
3024

31-
if data.get("allowedEmails") is not None:
32-
kwargs["allowed_emails"] = data["allowedEmails"]
33-
3425
return BuiltinEmailConnection(**kwargs)

src/userhub_sdk/adminv1/_postmark_connection.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Code generated. DO NOT EDIT.
22

33
import dataclasses
4-
from typing import Any, Dict, List, Optional
4+
from typing import Any, Dict, Optional
55

66
from userhub_sdk import commonv1
77

@@ -25,8 +25,6 @@ class PostmarkConnection:
2525
from_: Optional[commonv1.Email] = None
2626
#: The reply to email address.
2727
reply_to: Optional[commonv1.Email] = None
28-
#: The allowed email list.
29-
allowed_emails: List[str] = dataclasses.field(default_factory=list)
3028

3129
def __json_encode__(self) -> Dict[str, Any]:
3230
data: Dict[str, Any] = {}
@@ -43,9 +41,6 @@ def __json_encode__(self) -> Dict[str, Any]:
4341
if self.reply_to is not None:
4442
data["replyTo"] = commonv1.Email.__json_encode__(self.reply_to)
4543

46-
if self.allowed_emails is not None:
47-
data["allowedEmails"] = self.allowed_emails
48-
4944
return data
5045

5146
@staticmethod
@@ -67,7 +62,4 @@ def __json_decode__(data: Dict[str, Any]) -> "PostmarkConnection":
6762
if data.get("replyTo") is not None:
6863
kwargs["reply_to"] = commonv1.Email.__json_decode__(data["replyTo"])
6964

70-
if data.get("allowedEmails") is not None:
71-
kwargs["allowed_emails"] = data["allowedEmails"]
72-
7365
return PostmarkConnection(**kwargs)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Code generated. DO NOT EDIT.
2+
3+
import dataclasses
4+
from typing import Any, Dict
5+
6+
7+
@dataclasses.dataclass
8+
class ReportUserActionResponse:
9+
"""
10+
Response message for ReportUserAction.
11+
"""
12+
13+
def __json_encode__(self) -> Dict[str, Any]:
14+
data: Dict[str, Any] = {}
15+
16+
return data
17+
18+
@staticmethod
19+
def __json_decode__(data: Dict[str, Any]) -> "ReportUserActionResponse":
20+
if data is None:
21+
data = {}
22+
23+
kwargs: Dict[str, Any] = {}
24+
25+
return ReportUserActionResponse(**kwargs)

0 commit comments

Comments
 (0)