workos 5.27.0__py3-none-any.whl → 5.28.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
workos/__about__.py CHANGED
@@ -12,7 +12,7 @@ __package_name__ = "workos"
12
12
 
13
13
  __package_url__ = "https://github.com/workos-inc/workos-python"
14
14
 
15
- __version__ = "5.27.0"
15
+ __version__ = "5.28.0"
16
16
 
17
17
  __author__ = "WorkOS"
18
18
 
workos/session.py CHANGED
@@ -102,6 +102,7 @@ class SessionModule(Protocol):
102
102
  session_id=decoded["sid"],
103
103
  organization_id=decoded.get("org_id", None),
104
104
  role=decoded.get("role", None),
105
+ roles=decoded.get("roles", None),
105
106
  permissions=decoded.get("permissions", None),
106
107
  entitlements=decoded.get("entitlements", None),
107
108
  user=session["user"],
@@ -229,6 +230,7 @@ class Session(SessionModule):
229
230
  session_id=decoded["sid"],
230
231
  organization_id=decoded.get("org_id", None),
231
232
  role=decoded.get("role", None),
233
+ roles=decoded.get("roles", None),
232
234
  permissions=decoded.get("permissions", None),
233
235
  entitlements=decoded.get("entitlements", None),
234
236
  user=auth_response.user,
@@ -319,6 +321,7 @@ class AsyncSession(SessionModule):
319
321
  session_id=decoded["sid"],
320
322
  organization_id=decoded.get("org_id", None),
321
323
  role=decoded.get("role", None),
324
+ roles=decoded.get("roles", None),
322
325
  permissions=decoded.get("permissions", None),
323
326
  entitlements=decoded.get("entitlements", None),
324
327
  user=auth_response.user,
@@ -1,4 +1,4 @@
1
- from typing import Literal
1
+ from typing import Literal, Sequence, Optional
2
2
  from typing_extensions import TypedDict
3
3
 
4
4
  from workos.types.workos_model import WorkOSModel
@@ -19,6 +19,7 @@ class OrganizationMembership(WorkOSModel):
19
19
  user_id: str
20
20
  organization_id: str
21
21
  role: OrganizationMembershipRole
22
+ roles: Optional[Sequence[OrganizationMembershipRole]] = None
22
23
  status: LiteralOrUntyped[OrganizationMembershipStatus]
23
24
  created_at: str
24
25
  updated_at: str
@@ -1,6 +1,8 @@
1
- from typing import Optional, Sequence, TypedDict, Union
2
1
  from enum import Enum
2
+ from typing import Optional, Sequence, TypedDict, Union
3
+
3
4
  from typing_extensions import Literal
5
+
4
6
  from workos.types.user_management.impersonator import Impersonator
5
7
  from workos.types.user_management.user import User
6
8
  from workos.types.workos_model import WorkOSModel
@@ -17,6 +19,7 @@ class AuthenticateWithSessionCookieSuccessResponse(WorkOSModel):
17
19
  session_id: str
18
20
  organization_id: Optional[str] = None
19
21
  role: Optional[str] = None
22
+ roles: Optional[Sequence[str]] = None
20
23
  permissions: Optional[Sequence[str]] = None
21
24
  user: User
22
25
  impersonator: Optional[Impersonator] = None
@@ -1,9 +1,9 @@
1
1
  from typing import Literal, Union
2
+
2
3
  from pydantic import Field
3
4
  from typing_extensions import Annotated
5
+
4
6
  from workos.types.directory_sync import DirectoryGroup
5
- from workos.types.user_management import OrganizationMembership, User
6
- from workos.types.webhooks.webhook_model import WebhookModel
7
7
  from workos.types.directory_sync.directory_user import DirectoryUser
8
8
  from workos.types.events.authentication_payload import (
9
9
  AuthenticationEmailVerificationSucceededPayload,
@@ -37,16 +37,18 @@ from workos.types.events.organization_domain_verification_failed_payload import
37
37
  OrganizationDomainVerificationFailedPayload,
38
38
  )
39
39
  from workos.types.events.session_created_payload import SessionCreatedPayload
40
- from workos.types.organizations.organization_common import OrganizationCommon
41
40
  from workos.types.organization_domains import OrganizationDomain
41
+ from workos.types.organizations.organization_common import OrganizationCommon
42
42
  from workos.types.roles.role import EventRole
43
43
  from workos.types.sso.connection import Connection
44
+ from workos.types.user_management import OrganizationMembership, User
44
45
  from workos.types.user_management.email_verification import (
45
46
  EmailVerificationCommon,
46
47
  )
47
48
  from workos.types.user_management.invitation import InvitationCommon
48
49
  from workos.types.user_management.magic_auth import MagicAuthCommon
49
50
  from workos.types.user_management.password_reset import PasswordResetCommon
51
+ from workos.types.webhooks.webhook_model import WebhookModel
50
52
 
51
53
  # README
52
54
  # When adding a new webhook event type, ensure the new webhook class is
@@ -205,6 +207,18 @@ class OrganizationDomainVerifiedWebhook(WebhookModel[OrganizationDomain]):
205
207
  event: Literal["organization_domain.verified"]
206
208
 
207
209
 
210
+ class OrganizationDomainCreatedWebhook(WebhookModel[OrganizationDomain]):
211
+ event: Literal["organization_domain.created"]
212
+
213
+
214
+ class OrganizationDomainUpdatedWebhook(WebhookModel[OrganizationDomain]):
215
+ event: Literal["organization_domain.updated"]
216
+
217
+
218
+ class OrganizationDomainDeletedWebhook(WebhookModel[OrganizationDomain]):
219
+ event: Literal["organization_domain.deleted"]
220
+
221
+
208
222
  class OrganizationMembershipCreatedWebhook(WebhookModel[OrganizationMembership]):
209
223
  event: Literal["organization_membership.created"]
210
224
 
@@ -286,6 +300,9 @@ Webhook = Annotated[
286
300
  OrganizationCreatedWebhook,
287
301
  OrganizationDeletedWebhook,
288
302
  OrganizationUpdatedWebhook,
303
+ OrganizationDomainCreatedWebhook,
304
+ OrganizationDomainDeletedWebhook,
305
+ OrganizationDomainUpdatedWebhook,
289
306
  OrganizationDomainVerificationFailedWebhook,
290
307
  OrganizationDomainVerifiedWebhook,
291
308
  OrganizationMembershipCreatedWebhook,
workos/user_management.py CHANGED
@@ -245,15 +245,24 @@ class UserManagementModule(Protocol):
245
245
  ...
246
246
 
247
247
  def create_organization_membership(
248
- self, *, user_id: str, organization_id: str, role_slug: Optional[str] = None
248
+ self,
249
+ *,
250
+ user_id: str,
251
+ organization_id: str,
252
+ role_slug: Optional[str] = None,
253
+ role_slugs: Optional[Sequence[str]] = None,
249
254
  ) -> SyncOrAsync[OrganizationMembership]:
250
255
  """Create a new OrganizationMembership for the given Organization and User.
251
256
 
252
257
  Kwargs:
253
- user_id: The Unique ID of the User.
254
- organization_id: The Unique ID of the Organization to which the user belongs to.
255
- role_slug: The Unique Slug of the Role to which to grant to this membership.
256
- If no slug is passed in, the default role will be granted.(Optional)
258
+ user_id: The unique ID of the User.
259
+ organization_id: The unique ID of the Organization to which the user belongs to.
260
+ role_slug: The unique slug of the role to grant to this membership.(Optional)
261
+ role_slugs: The unique slugs of the roles to grant to this membership.(Optional)
262
+
263
+ Note:
264
+ role_slug and role_slugs are mutually exclusive. If neither is provided,
265
+ the user will be assigned the organization's default role.
257
266
 
258
267
  Returns:
259
268
  OrganizationMembership: Created OrganizationMembership response from WorkOS.
@@ -261,14 +270,22 @@ class UserManagementModule(Protocol):
261
270
  ...
262
271
 
263
272
  def update_organization_membership(
264
- self, *, organization_membership_id: str, role_slug: Optional[str] = None
273
+ self,
274
+ *,
275
+ organization_membership_id: str,
276
+ role_slug: Optional[str] = None,
277
+ role_slugs: Optional[Sequence[str]] = None,
265
278
  ) -> SyncOrAsync[OrganizationMembership]:
266
279
  """Updates an OrganizationMembership for the given id.
267
280
 
268
281
  Args:
269
282
  organization_membership_id (str): The unique ID of the Organization Membership.
270
- role_slug: The Unique Slug of the Role to which to grant to this membership.
271
- If no slug is passed in, it will not be changed (Optional)
283
+ role_slug: The unique slug of the role to grant to this membership.(Optional)
284
+ role_slugs: The unique slugs of the roles to grant to this membership.(Optional)
285
+
286
+ Note:
287
+ role_slug and role_slugs are mutually exclusive. If neither is provided,
288
+ the role(s) of the membership will remain unchanged.
272
289
 
273
290
  Returns:
274
291
  OrganizationMembership: Updated OrganizationMembership response from WorkOS.
@@ -988,12 +1005,18 @@ class UserManagement(UserManagementModule):
988
1005
  )
989
1006
 
990
1007
  def create_organization_membership(
991
- self, *, user_id: str, organization_id: str, role_slug: Optional[str] = None
1008
+ self,
1009
+ *,
1010
+ user_id: str,
1011
+ organization_id: str,
1012
+ role_slug: Optional[str] = None,
1013
+ role_slugs: Optional[Sequence[str]] = None,
992
1014
  ) -> OrganizationMembership:
993
1015
  json = {
994
1016
  "user_id": user_id,
995
1017
  "organization_id": organization_id,
996
1018
  "role_slug": role_slug,
1019
+ "role_slugs": role_slugs,
997
1020
  }
998
1021
 
999
1022
  response = self._http_client.request(
@@ -1003,10 +1026,15 @@ class UserManagement(UserManagementModule):
1003
1026
  return OrganizationMembership.model_validate(response)
1004
1027
 
1005
1028
  def update_organization_membership(
1006
- self, *, organization_membership_id: str, role_slug: Optional[str] = None
1029
+ self,
1030
+ *,
1031
+ organization_membership_id: str,
1032
+ role_slug: Optional[str] = None,
1033
+ role_slugs: Optional[Sequence[str]] = None,
1007
1034
  ) -> OrganizationMembership:
1008
1035
  json = {
1009
1036
  "role_slug": role_slug,
1037
+ "role_slugs": role_slugs,
1010
1038
  }
1011
1039
 
1012
1040
  response = self._http_client.request(
@@ -1614,12 +1642,18 @@ class AsyncUserManagement(UserManagementModule):
1614
1642
  )
1615
1643
 
1616
1644
  async def create_organization_membership(
1617
- self, *, user_id: str, organization_id: str, role_slug: Optional[str] = None
1645
+ self,
1646
+ *,
1647
+ user_id: str,
1648
+ organization_id: str,
1649
+ role_slug: Optional[str] = None,
1650
+ role_slugs: Optional[Sequence[str]] = None,
1618
1651
  ) -> OrganizationMembership:
1619
1652
  json = {
1620
1653
  "user_id": user_id,
1621
1654
  "organization_id": organization_id,
1622
1655
  "role_slug": role_slug,
1656
+ "role_slugs": role_slugs,
1623
1657
  }
1624
1658
 
1625
1659
  response = await self._http_client.request(
@@ -1629,10 +1663,15 @@ class AsyncUserManagement(UserManagementModule):
1629
1663
  return OrganizationMembership.model_validate(response)
1630
1664
 
1631
1665
  async def update_organization_membership(
1632
- self, *, organization_membership_id: str, role_slug: Optional[str] = None
1666
+ self,
1667
+ *,
1668
+ organization_membership_id: str,
1669
+ role_slug: Optional[str] = None,
1670
+ role_slugs: Optional[Sequence[str]] = None,
1633
1671
  ) -> OrganizationMembership:
1634
1672
  json = {
1635
1673
  "role_slug": role_slug,
1674
+ "role_slugs": role_slugs,
1636
1675
  }
1637
1676
 
1638
1677
  response = await self._http_client.request(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: workos
3
- Version: 5.27.0
3
+ Version: 5.28.0
4
4
  Summary: WorkOS Python Client
5
5
  Home-page: https://github.com/workos-inc/workos-python
6
6
  Author: WorkOS
@@ -1,4 +1,4 @@
1
- workos/__about__.py,sha256=44_g5uJBX2ZmRGExzrm8kphS58DJWlXIfHZS-jIhELw,406
1
+ workos/__about__.py,sha256=znw1lA9UVmwv7yB9SUBmmi21g6RgjQkNPwW9Buge2EE,406
2
2
  workos/__init__.py,sha256=hOdbO_MJCvpLx8EbRjQg-fvFAB-glJmrmxUZK8kWG0k,167
3
3
  workos/_base_client.py,sha256=YWLXBpd0YeID3WKYZkKa4l9ZuB9e6HgdLmPKZIzXsME,3599
4
4
  workos/_client_configuration.py,sha256=g3eXhtrEMN6CW0hZ5uHb2PmLurXjyBkWZeQYMPeJD6s,222
@@ -15,9 +15,9 @@ workos/organizations.py,sha256=ugPRhwN8cN2O6qOCf7wj8Wus-oeRKXlNe2642PSl_n4,12266
15
15
  workos/passwordless.py,sha256=NGXDoxomBkrIml8-VHXH1HvCFMqotQ-YhRobUQXpVZs,3203
16
16
  workos/portal.py,sha256=lzf3fnOor4AyVdHCHMuJzVSpAC9LWWdC5sZIRtCsb0c,2443
17
17
  workos/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- workos/session.py,sha256=EXurDn7wTRsciRSN_nN98tRD9hhw28eIMLrMNxWhyy0,12071
18
+ workos/session.py,sha256=i5znIJjfMHejpaeXKmRjFR_G5FA9-5KQYAF0VsLasgw,12217
19
19
  workos/sso.py,sha256=ZBC3y-IRmxG0jPd0BOj7s7XQkXJoTLUg1fx-h3Gfy4g,13541
20
- workos/user_management.py,sha256=qy21HxYVO40xo7TvCGVxvGWdYIFHZTVnUJTpCQIN2ko,77113
20
+ workos/user_management.py,sha256=gjDfrO_kNQxJDza443rH9topSDlTGBW-O_TUYp46ops,78107
21
21
  workos/vault.py,sha256=SJXr3nJ03qJFuf30FjevMD6LLlDNX3MGaKlYGgICRRE,15657
22
22
  workos/webhooks.py,sha256=CuwBxh6va9VZFVSXOknveGt6CCGDF3em07a-J12DbXI,4790
23
23
  workos/widgets.py,sha256=bfbR0hQOHZabbgGL2ekD5sY1sjiUoWBTdrBd_a6WmBc,1721
@@ -97,18 +97,18 @@ workos/types/user_management/invitation.py,sha256=4fK-Fk786MlhzZvvOrZtU_6SCJXmem
97
97
  workos/types/user_management/list_filters.py,sha256=qgJUKUuVmBIG1g-rdaq9vLAW1gu14WzJ67ctPVlFEtg,687
98
98
  workos/types/user_management/magic_auth.py,sha256=Sda13_uMOC-hHlyGeOXNnCn-HrpwUmtrf2hO5ek9U98,359
99
99
  workos/types/user_management/oauth_tokens.py,sha256=bETJTZ-Y50h6ib7w5vVbWFGv-xlvhI40sKGz7_l4YSE,445
100
- workos/types/user_management/organization_membership.py,sha256=iYcf6D6zbrdHdrUMzPs-bk_z9e4RWy3idwW1waDaBks,650
100
+ workos/types/user_management/organization_membership.py,sha256=dllONFtD1IZZiyqxnV8lJpJyH55OeOeaHRBDZlcWLwk,735
101
101
  workos/types/user_management/password_hash_type.py,sha256=1752LWdXbaH6TZ6IxbJWeRwlYXX9zN5iJATTaDrCQVA,93
102
102
  workos/types/user_management/password_reset.py,sha256=-NJCfEh4Q1xS9fFXJaF_acYeuUc9POqERLh8urMhqt8,403
103
103
  workos/types/user_management/screen_hint.py,sha256=DnPgvjRK-20i82v3YPzggna1rc6yOMyhiqwUdk01L3s,75
104
- workos/types/user_management/session.py,sha256=pyINOo_a53rxtZ-gGYOZziNHoZzc7s56evKgVAPIgMo,1390
104
+ workos/types/user_management/session.py,sha256=ckDH0Opgp8-w-08FBJax3sPNCGzxSg9z1JzsjbUNryQ,1434
105
105
  workos/types/user_management/user.py,sha256=aXRHsLXnQbXWBPRTdAP9Ym_-D9hjmrp_E4PTPi1gF1s,603
106
106
  workos/types/user_management/user_management_provider_type.py,sha256=UEjtcs9oeDvL9248bFy8nRfzutA6aBfhVMuMByG0qsM,145
107
107
  workos/types/vault/__init__.py,sha256=krBuIl8luysrtDf9-b8KTkXOHDOaSsOR-Aao6Wlil0Q,41
108
108
  workos/types/vault/key.py,sha256=x30XBplSj9AviDDAB8MdpcULbZvvo2sUzi8RCmZQKxU,453
109
109
  workos/types/vault/object.py,sha256=-rk4KovS3eT8T8L3JltYUS0cd2Rg1JKcAX9SOaZO3D8,664
110
110
  workos/types/webhooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
111
- workos/types/webhooks/webhook.py,sha256=X8fhXpUGlbHmQnOZqWh5he0XOH1aSbd5yIHT5GM9AG8,9795
111
+ workos/types/webhooks/webhook.py,sha256=C7PcSxQFVKxQ81K_XlO2WUHYA9U6rm4dKzltiY4yxW0,10301
112
112
  workos/types/webhooks/webhook_model.py,sha256=v7Hgtzt0nW_5RaYoB_QGVfElhdjySuG3F1BFjoid36w,404
113
113
  workos/types/webhooks/webhook_payload.py,sha256=GXt31KtyBM-ji5K5p4dBnu46Gh8adQWTq0ye5USB_6g,68
114
114
  workos/types/widgets/__init__.py,sha256=z2Tdlj_bJsRZeJRh4SOFX58PvJdf0LjKnYhrQX1fpME,65
@@ -125,8 +125,8 @@ workos/utils/crypto_provider.py,sha256=QeQSR4t9xLlb90kEfl8onVUsf1yCkYq0EjFTxK0mU
125
125
  workos/utils/http_client.py,sha256=TM5yMFFExmAE8D2Z43-5O301tRbnylLG0aXO0isGorE,6197
126
126
  workos/utils/pagination_order.py,sha256=_-et1DDJLG0czarTU7op4W6RA0V1f85GNsUgtyRU55Q,70
127
127
  workos/utils/request_helper.py,sha256=NaO16qPPbSNnCeE0fiNKYb8gM-dK_okYVJbLGrEGXz8,793
128
- workos-5.27.0.dist-info/LICENSE,sha256=mU--WL1JzelH2tXpKVoOlpud4cpqKSRTtdArCvYZmb4,1063
129
- workos-5.27.0.dist-info/METADATA,sha256=j1sWLVnRxXHdrpIO8uysMsf3logqWc3JUVkP8OHKwjI,4187
130
- workos-5.27.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
131
- workos-5.27.0.dist-info/top_level.txt,sha256=ZFskIfue1Tw-JwjyIXRvdsAl9i0DX9VbqmgICXV84Sk,7
132
- workos-5.27.0.dist-info/RECORD,,
128
+ workos-5.28.0.dist-info/LICENSE,sha256=mU--WL1JzelH2tXpKVoOlpud4cpqKSRTtdArCvYZmb4,1063
129
+ workos-5.28.0.dist-info/METADATA,sha256=GzcMauckW9CSQtqN7REffVNq8smSS2vRCJUb9Nad9B8,4187
130
+ workos-5.28.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
131
+ workos-5.28.0.dist-info/top_level.txt,sha256=ZFskIfue1Tw-JwjyIXRvdsAl9i0DX9VbqmgICXV84Sk,7
132
+ workos-5.28.0.dist-info/RECORD,,