Skip to content

Commit ef0619e

Browse files
fix(user_management): Update user management API surface
1 parent ba2eaf3 commit ef0619e

115 files changed

Lines changed: 853 additions & 900 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/workos/api_keys/models/create_organization_api_key.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from dataclasses import dataclass
66
from datetime import datetime
7-
from typing import Any, Dict, List, Optional
8-
from workos._types import _raise_deserialize_error
9-
from workos._types import _format_datetime, _parse_datetime
7+
from typing import Any
8+
9+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
1010

1111

1212
@dataclass(slots=True)
@@ -15,13 +15,13 @@ class CreateOrganizationApiKey:
1515

1616
name: str
1717
"""The name for the API key."""
18-
permissions: Optional[List[str]] = None
18+
permissions: list[str] | None = None
1919
"""The permission slugs to assign to the API key."""
20-
expires_at: Optional[datetime] = None
20+
expires_at: datetime | None = None
2121
"""The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire."""
2222

2323
@classmethod
24-
def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationApiKey":
24+
def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationApiKey:
2525
"""Deserialize from a dictionary."""
2626
try:
2727
return cls(
@@ -34,9 +34,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationApiKey":
3434
except (KeyError, ValueError) as e:
3535
_raise_deserialize_error("CreateOrganizationApiKey", e)
3636

37-
def to_dict(self) -> Dict[str, Any]:
37+
def to_dict(self) -> dict[str, Any]:
3838
"""Serialize to a dictionary."""
39-
result: Dict[str, Any] = {}
39+
result: dict[str, Any] = {}
4040
result["name"] = self.name
4141
if self.permissions is not None:
4242
result["permissions"] = self.permissions

src/workos/audit_logs/models/audit_log_event_create_response.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

@@ -15,7 +16,7 @@ class AuditLogEventCreateResponse:
1516
"""Whether the Audit Log event was created successfully."""
1617

1718
@classmethod
18-
def from_dict(cls, data: Dict[str, Any]) -> "AuditLogEventCreateResponse":
19+
def from_dict(cls, data: dict[str, Any]) -> AuditLogEventCreateResponse:
1920
"""Deserialize from a dictionary."""
2021
try:
2122
return cls(
@@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogEventCreateResponse":
2425
except (KeyError, ValueError) as e:
2526
_raise_deserialize_error("AuditLogEventCreateResponse", e)
2627

27-
def to_dict(self) -> Dict[str, Any]:
28+
def to_dict(self) -> dict[str, Any]:
2829
"""Serialize to a dictionary."""
29-
result: Dict[str, Any] = {}
30+
result: dict[str, Any] = {}
3031
result["success"] = self.success
3132
return result

src/workos/authorization/models/create_authorization_permission.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Optional
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

@@ -15,13 +16,13 @@ class CreateAuthorizationPermission:
1516
"""A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks."""
1617
name: str
1718
"""A descriptive name for the Permission."""
18-
description: Optional[str] = None
19+
description: str | None = None
1920
"""An optional description of the Permission."""
20-
resource_type_slug: Optional[str] = None
21+
resource_type_slug: str | None = None
2122
"""The slug of the resource type this permission is scoped to."""
2223

2324
@classmethod
24-
def from_dict(cls, data: Dict[str, Any]) -> "CreateAuthorizationPermission":
25+
def from_dict(cls, data: dict[str, Any]) -> CreateAuthorizationPermission:
2526
"""Deserialize from a dictionary."""
2627
try:
2728
return cls(
@@ -33,9 +34,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateAuthorizationPermission":
3334
except (KeyError, ValueError) as e:
3435
_raise_deserialize_error("CreateAuthorizationPermission", e)
3536

36-
def to_dict(self) -> Dict[str, Any]:
37+
def to_dict(self) -> dict[str, Any]:
3738
"""Serialize to a dictionary."""
38-
result: Dict[str, Any] = {}
39+
result: dict[str, Any] = {}
3940
result["slug"] = self.slug
4041
result["name"] = self.name
4142
if self.description is not None:

src/workos/authorization/models/create_authorization_resource.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Optional
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

@@ -19,17 +20,17 @@ class CreateAuthorizationResource:
1920
"""The slug of the resource type."""
2021
organization_id: str
2122
"""The ID of the organization this resource belongs to."""
22-
description: Optional[str] = None
23+
description: str | None = None
2324
"""An optional description of the resource."""
24-
parent_resource_id: Optional[str] = None
25+
parent_resource_id: str | None = None
2526
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
26-
parent_resource_external_id: Optional[str] = None
27+
parent_resource_external_id: str | None = None
2728
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
28-
parent_resource_type_slug: Optional[str] = None
29+
parent_resource_type_slug: str | None = None
2930
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
3031

3132
@classmethod
32-
def from_dict(cls, data: Dict[str, Any]) -> "CreateAuthorizationResource":
33+
def from_dict(cls, data: dict[str, Any]) -> CreateAuthorizationResource:
3334
"""Deserialize from a dictionary."""
3435
try:
3536
return cls(
@@ -45,9 +46,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateAuthorizationResource":
4546
except (KeyError, ValueError) as e:
4647
_raise_deserialize_error("CreateAuthorizationResource", e)
4748

48-
def to_dict(self) -> Dict[str, Any]:
49+
def to_dict(self) -> dict[str, Any]:
4950
"""Serialize to a dictionary."""
50-
result: Dict[str, Any] = {}
51+
result: dict[str, Any] = {}
5152
result["external_id"] = self.external_id
5253
result["name"] = self.name
5354
result["resource_type_slug"] = self.resource_type_slug

src/workos/authorization/models/create_organization_role.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Optional
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

@@ -13,15 +14,15 @@ class CreateOrganizationRole:
1314

1415
name: str
1516
"""A descriptive name for the role."""
16-
slug: Optional[str] = None
17+
slug: str | None = None
1718
"""A unique identifier for the role within the organization. When provided, must begin with 'org-' and contain only lowercase letters, numbers, hyphens, and underscores. When omitted, a slug is auto-generated from the role name and a random suffix."""
18-
description: Optional[str] = None
19+
description: str | None = None
1920
"""An optional description of the role's purpose."""
20-
resource_type_slug: Optional[str] = None
21+
resource_type_slug: str | None = None
2122
"""The slug of the resource type the role is scoped to."""
2223

2324
@classmethod
24-
def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationRole":
25+
def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationRole:
2526
"""Deserialize from a dictionary."""
2627
try:
2728
return cls(
@@ -33,9 +34,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationRole":
3334
except (KeyError, ValueError) as e:
3435
_raise_deserialize_error("CreateOrganizationRole", e)
3536

36-
def to_dict(self) -> Dict[str, Any]:
37+
def to_dict(self) -> dict[str, Any]:
3738
"""Serialize to a dictionary."""
38-
result: Dict[str, Any] = {}
39+
result: dict[str, Any] = {}
3940
result["name"] = self.name
4041
if self.slug is not None:
4142
result["slug"] = self.slug

src/workos/authorization/models/update_authorization_permission.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Optional
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

1011
@dataclass(slots=True)
1112
class UpdateAuthorizationPermission:
1213
"""Update Authorization Permission model."""
1314

14-
name: Optional[str] = None
15+
name: str | None = None
1516
"""A descriptive name for the Permission."""
16-
description: Optional[str] = None
17+
description: str | None = None
1718
"""An optional description of the Permission."""
1819

1920
@classmethod
20-
def from_dict(cls, data: Dict[str, Any]) -> "UpdateAuthorizationPermission":
21+
def from_dict(cls, data: dict[str, Any]) -> UpdateAuthorizationPermission:
2122
"""Deserialize from a dictionary."""
2223
try:
2324
return cls(
@@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateAuthorizationPermission":
2728
except (KeyError, ValueError) as e:
2829
_raise_deserialize_error("UpdateAuthorizationPermission", e)
2930

30-
def to_dict(self) -> Dict[str, Any]:
31+
def to_dict(self) -> dict[str, Any]:
3132
"""Serialize to a dictionary."""
32-
result: Dict[str, Any] = {}
33+
result: dict[str, Any] = {}
3334
if self.name is not None:
3435
result["name"] = self.name
3536
if self.description is not None:

src/workos/authorization/models/update_authorization_resource.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Optional
6+
from typing import Any
7+
78
from workos._types import _raise_deserialize_error
89

910

1011
@dataclass(slots=True)
1112
class UpdateAuthorizationResource:
1213
"""Update Authorization Resource model."""
1314

14-
name: Optional[str] = None
15+
name: str | None = None
1516
"""A display name for the resource."""
16-
description: Optional[str] = None
17+
description: str | None = None
1718
"""An optional description of the resource."""
18-
parent_resource_id: Optional[str] = None
19+
parent_resource_id: str | None = None
1920
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
20-
parent_resource_external_id: Optional[str] = None
21+
parent_resource_external_id: str | None = None
2122
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
22-
parent_resource_type_slug: Optional[str] = None
23+
parent_resource_type_slug: str | None = None
2324
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
2425

2526
@classmethod
26-
def from_dict(cls, data: Dict[str, Any]) -> "UpdateAuthorizationResource":
27+
def from_dict(cls, data: dict[str, Any]) -> UpdateAuthorizationResource:
2728
"""Deserialize from a dictionary."""
2829
try:
2930
return cls(
@@ -36,9 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateAuthorizationResource":
3637
except (KeyError, ValueError) as e:
3738
_raise_deserialize_error("UpdateAuthorizationResource", e)
3839

39-
def to_dict(self) -> Dict[str, Any]:
40+
def to_dict(self) -> dict[str, Any]:
4041
"""Serialize to a dictionary."""
41-
result: Dict[str, Any] = {}
42+
result: dict[str, Any] = {}
4243
if self.name is not None:
4344
result["name"] = self.name
4445
if self.description is not None:

src/workos/common/models/agent_registration_claim_attempt_created.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
from dataclasses import dataclass
66
from datetime import datetime
7-
from typing import cast
8-
from typing import Any, Dict, Literal, Optional
9-
from workos._types import _raise_deserialize_error
10-
from workos._types import _format_datetime, _parse_datetime
7+
from typing import Any, Literal, cast
8+
9+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
1110

1211
from .agent_registration_claim_attempt_created_data import (
1312
AgentRegistrationClaimAttemptCreatedData,
@@ -24,34 +23,34 @@ class AgentRegistrationClaimAttemptCreated:
2423
id: str
2524
"""Unique identifier for the event."""
2625
event: Literal["agent.registration.claim.attempt.created"]
27-
data: "AgentRegistrationClaimAttemptCreatedData"
26+
data: AgentRegistrationClaimAttemptCreatedData
2827
"""The event payload."""
2928
created_at: datetime
3029
"""An ISO 8601 timestamp."""
31-
context: Optional["EventContext"] = None
30+
context: EventContext | None = None
3231

3332
@classmethod
34-
def from_dict(cls, data: Dict[str, Any]) -> "AgentRegistrationClaimAttemptCreated":
33+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimAttemptCreated:
3534
"""Deserialize from a dictionary."""
3635
try:
3736
return cls(
3837
object=data.get("object", "event"),
3938
id=data["id"],
4039
event=data.get("event", "agent.registration.claim.attempt.created"),
4140
data=AgentRegistrationClaimAttemptCreatedData.from_dict(
42-
cast(Dict[str, Any], data["data"])
41+
cast(dict[str, Any], data["data"])
4342
),
4443
created_at=_parse_datetime(data["created_at"]),
45-
context=EventContext.from_dict(cast(Dict[str, Any], _v_context))
44+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
4645
if (_v_context := data.get("context")) is not None
4746
else None,
4847
)
4948
except (KeyError, ValueError) as e:
5049
_raise_deserialize_error("AgentRegistrationClaimAttemptCreated", e)
5150

52-
def to_dict(self) -> Dict[str, Any]:
51+
def to_dict(self) -> dict[str, Any]:
5352
"""Serialize to a dictionary."""
54-
result: Dict[str, Any] = {}
53+
result: dict[str, Any] = {}
5554
result["object"] = self.object
5655
result["id"] = self.id
5756
result["event"] = self.event

src/workos/common/models/agent_registration_claim_attempt_created_data.py

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

55
from dataclasses import dataclass
6-
from typing import Any, Dict, Literal
6+
from typing import Any, Literal
7+
78
from workos._types import _raise_deserialize_error
89

910

@@ -30,8 +31,8 @@ class AgentRegistrationClaimAttemptCreatedData:
3031

3132
@classmethod
3233
def from_dict(
33-
cls, data: Dict[str, Any]
34-
) -> "AgentRegistrationClaimAttemptCreatedData":
34+
cls, data: dict[str, Any]
35+
) -> AgentRegistrationClaimAttemptCreatedData:
3536
"""Deserialize from a dictionary."""
3637
try:
3738
return cls(
@@ -47,9 +48,9 @@ def from_dict(
4748
except (KeyError, ValueError) as e:
4849
_raise_deserialize_error("AgentRegistrationClaimAttemptCreatedData", e)
4950

50-
def to_dict(self) -> Dict[str, Any]:
51+
def to_dict(self) -> dict[str, Any]:
5152
"""Serialize to a dictionary."""
52-
result: Dict[str, Any] = {}
53+
result: dict[str, Any] = {}
5354
result["object"] = self.object
5455
result["id"] = self.id
5556
result["agent_registration_id"] = self.agent_registration_id

0 commit comments

Comments
 (0)