Repository navigation
feat(generated): AdminPortal, Agents, ApiKeys, AuditLogs, Authorization, ClientApi, Connect, DirectorySync, Events, FeatureFlags, Groups, MultiFactorAuth, OrganizationDomains, OrganizationMembership, Organizations, Pipes, PipesProvider, PlatformTeams, Radar, SSO, UserManagement, Vault, Webhooks, Widgets (batch aeefef11) #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| * [#752](https://github.com/workos/workos-python/pull/752) fix(generated): regenerate from spec | ||
|
|
||
| **Features** | ||
| * **[agents](https://workos.com/docs/reference/agents)**: | ||
| * Added `revoked_at` to `AgentRegistration` | ||
| * Added endpoint `POST /agents/registrations/{id}/revoke` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| d430b394483f6e00ff7f9e2ca8d4340ff8f7aa54 | ||
| 4ecccdfeab4244ffaf428c96b1615bf0440b4c0f |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |||||||
| from workos.common.models.authorization_permission import ( | ||||||||
| AuthorizationPermission as AuthorizationPermission, | ||||||||
| ) | ||||||||
| from workos.common.models.list_metadata import ListMetadata as ListMetadata | ||||||||
| from workos.common.models.slim_role import SlimRole as SlimRole | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Removing
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/authorization/models/__init__.py
Line: 9
Comment:
**Existing authorization imports fail**
Removing `ListMetadata` breaks existing imports from `workos.authorization.models`. It also removes the name from `workos.authorization`, which forwards these exports. Applications using either import now fail with `ImportError`. Keep the existing export alongside the new export in `agents`.
```suggestion
from workos.common.models.list_metadata import ListMetadata as ListMetadata
from workos.common.models.slim_role import SlimRole as SlimRole
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||||||||
|
|
||||||||
| from .assign_role import AssignRole as AssignRole | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,14 @@ | |
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
| from typing import Any | ||
| from typing import Any, cast | ||
|
|
||
| from workos._types import _raise_deserialize_error | ||
|
|
||
| from .flag_updated_context_previous_attribute_data_owner import ( | ||
| FlagUpdatedContextPreviousAttributeDataOwner, | ||
| ) | ||
|
|
||
|
|
||
| @dataclass(slots=True) | ||
| class FlagUpdatedContextPreviousAttributeData: | ||
|
|
@@ -18,6 +22,8 @@ class FlagUpdatedContextPreviousAttributeData: | |
| """The previous description of the flag.""" | ||
| tags: list[str] | None = None | ||
| """The previous tags of the flag.""" | ||
| owner: FlagUpdatedContextPreviousAttributeDataOwner | None = None | ||
| """The previous owner of the flag, or `null` if it had none.""" | ||
| enabled: bool | None = None | ||
| """Whether the flag was previously enabled.""" | ||
| default_value: bool | None = None | ||
|
|
@@ -31,6 +37,11 @@ def from_dict(cls, data: dict[str, Any]) -> FlagUpdatedContextPreviousAttributeD | |
| name=data.get("name"), | ||
| description=data.get("description"), | ||
| tags=data.get("tags"), | ||
| owner=FlagUpdatedContextPreviousAttributeDataOwner.from_dict( | ||
| cast(dict[str, Any], _v_owner) | ||
| ) | ||
| if (_v_owner := data.get("owner")) is not None | ||
| else None, | ||
| enabled=data.get("enabled"), | ||
| default_value=data.get("default_value"), | ||
| ) | ||
|
|
@@ -48,6 +59,10 @@ def to_dict(self) -> dict[str, Any]: | |
| result["description"] = None | ||
| if self.tags is not None: | ||
| result["tags"] = self.tags | ||
| if self.owner is not None: | ||
| result["owner"] = self.owner.to_dict() | ||
| else: | ||
| result["owner"] = None | ||
|
Comment on lines
+62
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Serializing previous flag attributes now adds Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/common/models/flag_updated_context_previous_attribute_data.py
Line: 62-65
Comment:
**Unchanged owners become null**
Serializing previous flag attributes now adds `"owner": null` even when the input omitted `owner`. These attributes describe fields that changed, so an update that only changed `enabled` should not gain a previous-owner entry. Callers that serialize parsed events receive a value the event never supplied. Preserve the difference between an omitted `owner` and an explicit null, and test a round trip where `owner` is absent.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
| if self.enabled is not None: | ||
| result["enabled"] = self.enabled | ||
| if self.default_value is not None: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # This file is auto-generated by oagen. Do not edit. | ||
|
|
||
| from typing import TypeAlias | ||
|
|
||
| from .feature_flag_owner import FeatureFlagOwner | ||
|
|
||
| FlagUpdatedContextPreviousAttributeDataOwner: TypeAlias = FeatureFlagOwner |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "email": "jane@example.com", | ||
| "first_name": "Jane", | ||
| "last_name": "Doe" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,6 +202,18 @@ def test_get_registration(self, workos, httpx_mock): | |
| assert request.method == "GET" | ||
| assert request.url.path.endswith("/agents/registrations/test_id") | ||
|
|
||
| def test_revoke_registration(self, workos, httpx_mock): | ||
| httpx_mock.add_response( | ||
| json=load_fixture("agent_registration.json"), | ||
| ) | ||
| result = workos.agents.revoke_registration("test_id") | ||
| assert isinstance(result, AgentRegistration) | ||
| assert result.id == "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY" | ||
| assert result.organization_id == "org_01EHQMYV6MBK39QC5PZXHY59C3" | ||
|
Comment on lines
+205
to
+212
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Both new revoke tests return an unrevoked registration fixture, and neither checks Prompt To Fix With AIThis is a comment left during a code review.
Path: tests/test_agents.py
Line: 205-212
Comment:
**Revoked timestamps go untested**
Both new revoke tests return an unrevoked registration fixture, and neither checks `revoked_at`. The added model tests also use only null timestamps, so the new timestamp parsing and formatting paths are never exercised. Return a non-null timestamp in the revoke tests and check both the parsed value and its serialized form.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
| request = httpx_mock.get_request() | ||
| assert request.method == "POST" | ||
| assert request.url.path.endswith("/agents/registrations/test_id/revoke") | ||
|
|
||
| def test_list_instances(self, workos, httpx_mock): | ||
| httpx_mock.add_response( | ||
| json=load_fixture("list_agent_instance.json"), | ||
|
|
@@ -546,6 +558,17 @@ async def test_get_registration(self, async_workos, httpx_mock): | |
| assert request.method == "GET" | ||
| assert request.url.path.endswith("/agents/registrations/test_id") | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_revoke_registration(self, async_workos, httpx_mock): | ||
| httpx_mock.add_response(json=load_fixture("agent_registration.json")) | ||
| result = await async_workos.agents.revoke_registration("test_id") | ||
| assert isinstance(result, AgentRegistration) | ||
| assert result.id == "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY" | ||
| assert result.organization_id == "org_01EHQMYV6MBK39QC5PZXHY59C3" | ||
| request = httpx_mock.get_request() | ||
| assert request.method == "POST" | ||
| assert request.url.path.endswith("/agents/registrations/test_id/revoke") | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_list_instances(self, async_workos, httpx_mock): | ||
| httpx_mock.add_response(json=load_fixture("list_agent_instance.json")) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
revoked_atwithout a default breaks existingAgentRegistration(...)calls. A caller supplying every previously required argument now getsTypeErrorbecauserevoked_atis missing. Make the new field keyword-only with a default ofNone, or append it with that default, to preserve existing constructor calls.Prompt To Fix With AI