Skip to content

Commit 4b8ec7e

Browse files
gjtorikianclaude
andcommitted
fix: regenerate SDK with updated OpenAPI spec
Regenerated from spec changes: extracted DirectoryUser/EventContext schemas, SlimRole refs, limit type number->integer, RoleList ref. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 205346c commit 4b8ec7e

File tree

128 files changed

+5495
-14759
lines changed

Some content is hidden

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

128 files changed

+5495
-14759
lines changed

docs/V6_MIGRATION_GUIDE.md

Lines changed: 189 additions & 200 deletions
Large diffs are not rendered by default.

src/workos/audit_logs/models/audit_log_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AuditLogEvent:
2828
"""Additional context about where and how the action occurred."""
2929
metadata: Optional[Dict[str, Union[str, float, bool]]] = None
3030
"""Additional data associated with the event or entity."""
31-
version: Optional[float] = None
31+
version: Optional[int] = None
3232
"""What schema version the event is associated with."""
3333

3434
@classmethod

src/workos/authorization/_resource.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
AuthorizationCheck,
1313
AuthorizationPermission,
1414
AuthorizationResource,
15-
ListModel,
1615
Permission,
1716
Role,
1817
RoleAssignment,
@@ -328,7 +327,7 @@ def list_organization_roles(
328327
organization_id: str,
329328
*,
330329
request_options: Optional[RequestOptions] = None,
331-
) -> ListModel:
330+
) -> RoleList:
332331
"""List organization roles
333332
334333
Get a list of all roles that apply to an organization. This includes both environment roles and organization-specific roles, returned in priority order.
@@ -338,7 +337,7 @@ def list_organization_roles(
338337
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
339338
340339
Returns:
341-
ListModel
340+
RoleList
342341
343342
Raises:
344343
AuthorizationError: If the request is forbidden (403).
@@ -350,7 +349,7 @@ def list_organization_roles(
350349
return self._client.request(
351350
method="get",
352351
path=f"authorization/organizations/{organization_id}/roles",
353-
model=ListModel,
352+
model=RoleList,
354353
request_options=request_options,
355354
)
356355

@@ -361,6 +360,7 @@ def create_organization_roles(
361360
name: str,
362361
slug: Optional[str] = None,
363362
description: Optional[str] = None,
363+
resource_type_slug: Optional[str] = None,
364364
request_options: Optional[RequestOptions] = None,
365365
) -> Role:
366366
"""Create a custom organization role
@@ -372,6 +372,7 @@ def create_organization_roles(
372372
slug: 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.
373373
name: A descriptive name for the role.
374374
description: An optional description of the role's purpose.
375+
resource_type_slug: The slug of the resource type the role is scoped to.
375376
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
376377
377378
Returns:
@@ -393,6 +394,7 @@ def create_organization_roles(
393394
"slug": slug,
394395
"name": name,
395396
"description": description,
397+
"resource_type_slug": resource_type_slug,
396398
}.items()
397399
if v is not None
398400
}
@@ -1882,7 +1884,7 @@ async def list_organization_roles(
18821884
organization_id: str,
18831885
*,
18841886
request_options: Optional[RequestOptions] = None,
1885-
) -> ListModel:
1887+
) -> RoleList:
18861888
"""List organization roles
18871889
18881890
Get a list of all roles that apply to an organization. This includes both environment roles and organization-specific roles, returned in priority order.
@@ -1892,7 +1894,7 @@ async def list_organization_roles(
18921894
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
18931895
18941896
Returns:
1895-
ListModel
1897+
RoleList
18961898
18971899
Raises:
18981900
AuthorizationError: If the request is forbidden (403).
@@ -1904,7 +1906,7 @@ async def list_organization_roles(
19041906
return await self._client.request(
19051907
method="get",
19061908
path=f"authorization/organizations/{organization_id}/roles",
1907-
model=ListModel,
1909+
model=RoleList,
19081910
request_options=request_options,
19091911
)
19101912

@@ -1915,6 +1917,7 @@ async def create_organization_roles(
19151917
name: str,
19161918
slug: Optional[str] = None,
19171919
description: Optional[str] = None,
1920+
resource_type_slug: Optional[str] = None,
19181921
request_options: Optional[RequestOptions] = None,
19191922
) -> Role:
19201923
"""Create a custom organization role
@@ -1926,6 +1929,7 @@ async def create_organization_roles(
19261929
slug: 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.
19271930
name: A descriptive name for the role.
19281931
description: An optional description of the role's purpose.
1932+
resource_type_slug: The slug of the resource type the role is scoped to.
19291933
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
19301934
19311935
Returns:
@@ -1947,6 +1951,7 @@ async def create_organization_roles(
19471951
"slug": slug,
19481952
"name": name,
19491953
"description": description,
1954+
"resource_type_slug": resource_type_slug,
19501955
}.items()
19511956
if v is not None
19521957
}

src/workos/authorization/models/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
)
1717
from .create_organization_role import CreateOrganizationRole as CreateOrganizationRole
1818
from .create_role import CreateRole as CreateRole
19-
from .list import ListModel as ListModel
20-
from .list_data import ListData as ListData
2119
from .permission import Permission as Permission
2220
from .permissions_order import PermissionsOrder as PermissionsOrder
2321
from .remove_role import RemoveRole as RemoveRole

src/workos/authorization/models/create_organization_role.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CreateOrganizationRole:
1717
"""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."""
1818
description: Optional[str] = None
1919
"""An optional description of the role's purpose."""
20+
resource_type_slug: Optional[str] = None
21+
"""The slug of the resource type the role is scoped to."""
2022

2123
@classmethod
2224
def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationRole":
@@ -26,6 +28,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateOrganizationRole":
2628
name=data["name"],
2729
slug=data.get("slug"),
2830
description=data.get("description"),
31+
resource_type_slug=data.get("resource_type_slug"),
2932
)
3033
except (KeyError, ValueError) as e:
3134
_raise_deserialize_error("CreateOrganizationRole", e)
@@ -40,4 +43,6 @@ def to_dict(self) -> Dict[str, Any]:
4043
result["description"] = self.description
4144
else:
4245
result["description"] = None
46+
if self.resource_type_slug is not None:
47+
result["resource_type_slug"] = self.resource_type_slug
4348
return result
Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
# This file is auto-generated by oagen. Do not edit.
22

3-
from typing_extensions import TypeAlias
4-
from .list import ListModel
3+
from __future__ import annotations
54

6-
RoleList: TypeAlias = ListModel
5+
from dataclasses import dataclass
6+
from typing import cast
7+
from typing import Any, Dict, List, Literal
8+
from workos._types import _raise_deserialize_error
9+
10+
from .role import Role
11+
12+
13+
@dataclass(slots=True)
14+
class RoleList:
15+
"""Role List model."""
16+
17+
object: Literal["list"]
18+
data: List["Role"]
19+
"""The list of records for the current page."""
20+
21+
@classmethod
22+
def from_dict(cls, data: Dict[str, Any]) -> "RoleList":
23+
"""Deserialize from a dictionary."""
24+
try:
25+
return cls(
26+
object=data["object"],
27+
data=[
28+
Role.from_dict(cast(Dict[str, Any], item))
29+
for item in cast(list[Any], data["data"])
30+
],
31+
)
32+
except (KeyError, ValueError) as e:
33+
_raise_deserialize_error("RoleList", e)
34+
35+
def to_dict(self) -> Dict[str, Any]:
36+
"""Serialize to a dictionary."""
37+
result: Dict[str, Any] = {}
38+
result["object"] = self.object
39+
result["data"] = [item.to_dict() for item in self.data]
40+
return result

0 commit comments

Comments
 (0)