Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* [#778](https://github.com/workos/workos-python/pull/778) feat(generated): regenerate from spec (1 change)

**Features**
* **[sso](https://workos.com/docs/reference/sso)**:
* Added enum `ConnectionsState`
* Added parameter `Connections.list.state`
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cd2274094c76488d1aef6d661898b31138af5f3e
d23707bf603250a73e6433561428e58fc2be036b
1 change: 1 addition & 0 deletions .oagen-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@
"src/workos/sso/models/connection.py",
"src/workos/sso/models/connection_domain.py",
"src/workos/sso/models/connections_connection_type.py",
"src/workos/sso/models/connections_state.py",
"src/workos/sso/models/create_connection.py",
"src/workos/sso/models/create_connection_attribute_maps.py",
"src/workos/sso/models/create_connection_key_pair.py",
Expand Down
316 changes: 0 additions & 316 deletions src/workos/common/__init__.py

Large diffs are not rendered by default.

348 changes: 0 additions & 348 deletions src/workos/common/models/__init__.py

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/workos/organization_membership/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
from .user_management_organization_membership_statuses import (
UserManagementOrganizationMembershipStatuses as UserManagementOrganizationMembershipStatuses,
)
from .user_management_organization_membership_statuses import (
UserManagementOrganizationMembershipStatusesLiteral as UserManagementOrganizationMembershipStatusesLiteral,
)
from .user_organization_membership import (
UserOrganizationMembership as UserOrganizationMembership,
)
1 change: 0 additions & 1 deletion src/workos/pipes/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
OrganizationConnectedAccount as OrganizationConnectedAccount,
)
from .pipes_ownership import PipesOwnership as PipesOwnership

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Existing type imports fail

Removing the *Literal exports breaks existing imports. For example, from workos.pipes.models import PipesOwnershipLiteral now raises ImportError, even though the alias still exists in its source module. Applications using that import can fail to start after upgrading. This also affects workos.pipes and workos.types.pipes, which copy the model exports.

Restore these exports and the matching removals in the other model namespaces.

Knowledge Base Used: Pagination and shared types

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/workos/pipes/models/__init__.py
Line: 94

Comment:
**Existing type imports fail**

Removing the `*Literal` exports breaks existing imports. For example, `from workos.pipes.models import PipesOwnershipLiteral` now raises `ImportError`, even though the alias still exists in its source module. Applications using that import can fail to start after upgrading. This also affects `workos.pipes` and `workos.types.pipes`, which copy the model exports.

Restore these exports and the matching removals in the other model namespaces.

**Knowledge Base Used:** [Pagination and shared types](https://app.greptile.com/-/switch-tenant?tenant=workos&next=%2Fcustom-context%2Fknowledge-base%2Fworkos%2Fworkos-python%2F-%2Fdocs%2Fpagination-and-shared-types.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

from .pipes_ownership import PipesOwnershipLiteral as PipesOwnershipLiteral
from .update_custom_provider_definition import (
UpdateCustomProviderDefinition as UpdateCustomProviderDefinition,
)
Expand Down
3 changes: 0 additions & 3 deletions src/workos/pipes_provider/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
DataIntegrationCredentials as DataIntegrationCredentials,
)
from .pipes_provider_ownership import PipesProviderOwnership as PipesProviderOwnership
from .pipes_provider_ownership import (
PipesProviderOwnershipLiteral as PipesProviderOwnershipLiteral,
)
7 changes: 7 additions & 0 deletions src/workos/sso/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .models import (
Connection,
ConnectionsConnectionType,
ConnectionsState,
CreateConnectionAttributeMaps,
CreateConnectionOIDCOptions,
CreateConnectionSAMLOptions,
Expand Down Expand Up @@ -79,6 +80,7 @@ def list_connections(
domain: str | None = None,
organization_id: str | None = None,
search: str | None = None,
state: ConnectionsState | str | None = None,
request_options: RequestOptions | None = None,
) -> SyncPage[Connection]:
"""List Connections
Expand All @@ -94,6 +96,7 @@ def list_connections(
domain: Filter Connections by their associated domain.
organization_id: Filter Connections by their associated organization.
search: Searchable text to match against Connection names.
state: Filter Connections by their state.
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.

Returns:
Expand All @@ -119,6 +122,7 @@ def list_connections(
"domain": domain,
"organization_id": organization_id,
"search": search,
"state": enum_value(state) if state is not None else None,
}.items()
if v is not None
}
Expand Down Expand Up @@ -950,6 +954,7 @@ async def list_connections(
domain: str | None = None,
organization_id: str | None = None,
search: str | None = None,
state: ConnectionsState | str | None = None,
request_options: RequestOptions | None = None,
) -> AsyncPage[Connection]:
"""List Connections
Expand All @@ -965,6 +970,7 @@ async def list_connections(
domain: Filter Connections by their associated domain.
organization_id: Filter Connections by their associated organization.
search: Searchable text to match against Connection names.
state: Filter Connections by their state.
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.

Returns:
Expand All @@ -990,6 +996,7 @@ async def list_connections(
"domain": domain,
"organization_id": organization_id,
"search": search,
"state": enum_value(state) if state is not None else None,
}.items()
if v is not None
}
Expand Down
2 changes: 2 additions & 0 deletions src/workos/sso/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from .connections_connection_type import (
ConnectionsConnectionTypeLiteral as ConnectionsConnectionTypeLiteral,
)
from .connections_state import ConnectionsState as ConnectionsState
from .connections_state import ConnectionsStateLiteral as ConnectionsStateLiteral
from .create_connection import CreateConnection as CreateConnection
from .create_connection_attribute_maps import (
CreateConnectionAttributeMaps as CreateConnectionAttributeMaps,
Expand Down
28 changes: 28 additions & 0 deletions src/workos/sso/models/connections_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is auto-generated by oagen. Do not edit.

"""Enumeration of connections state values."""

from __future__ import annotations

from enum import Enum
from typing import Literal, TypeAlias


class ConnectionsState(str, Enum):
"""Known values for ConnectionsState."""

ACTIVE = "active"
INACTIVE = "inactive"
VALIDATING = "validating"

@classmethod
def _missing_(cls, value: object) -> ConnectionsState | None:
if not isinstance(value, str):
return None
unknown = str.__new__(cls, value)
unknown._name_ = value.upper()
unknown._value_ = value
return unknown


ConnectionsStateLiteral: TypeAlias = Literal["active", "inactive", "validating"]
3 changes: 0 additions & 3 deletions src/workos/user_management/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@
from .user_management_authentication_screen_hint import (
UserManagementAuthenticationScreenHint as UserManagementAuthenticationScreenHint,
)
from .user_management_authentication_screen_hint import (
UserManagementAuthenticationScreenHintLiteral as UserManagementAuthenticationScreenHintLiteral,
)
from .user_management_waitlists_state import (
UserManagementWaitlistsState as UserManagementWaitlistsState,
)
Expand Down
63 changes: 0 additions & 63 deletions tests/test_common_models_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,6 @@
OrganizationRoleUpdated,
OrganizationRoleUpdatedData,
OrganizationSelectionRequiredErrorBody,
OrganizationSelectionRequiredErrorBodyWithOrganization,
OrganizationSelectionRequiredErrorBodyWithOrganizations,
OrganizationUpdated,
OrganizationUpdatedData,
OrganizationUpdatedDataDomain,
Expand Down Expand Up @@ -607,67 +605,6 @@ def test_error_body_minimal_payload(self):
serialized = instance.to_dict()
assert serialized["message"] == data["message"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Existing model tests disappear

This removes four round-trip and minimal-payload tests for public models that remain in the SDK. No remaining test references OrganizationSelectionRequiredErrorBodyWithOrganizations, so future changes to its nested organization list can break without these checks catching it. Keep these tests; the new SSO filter tests do not replace their coverage.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_common_models_round_trip.py
Line: 606

Comment:
**Existing model tests disappear**

This removes four round-trip and minimal-payload tests for public models that remain in the SDK. No remaining test references `OrganizationSelectionRequiredErrorBodyWithOrganizations`, so future changes to its nested organization list can break without these checks catching it. Keep these tests; the new SSO filter tests do not replace their coverage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.


def test_organization_selection_required_error_body_with_organizations_round_trip(
self,
):
data = load_fixture(
"organization_selection_required_error_body_with_organizations.json"
)
instance = OrganizationSelectionRequiredErrorBodyWithOrganizations.from_dict(
data
)
serialized = instance.to_dict()
assert serialized == data
restored = OrganizationSelectionRequiredErrorBodyWithOrganizations.from_dict(
serialized
)
assert restored.to_dict() == serialized

def test_organization_selection_required_error_body_with_organizations_minimal_payload(
self,
):
data = {
"code": "organization_selection_required",
"message": "Request could not be processed.",
"organizations": [
{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
],
}
instance = OrganizationSelectionRequiredErrorBodyWithOrganizations.from_dict(
data
)
serialized = instance.to_dict()
assert serialized["code"] == data["code"]
assert serialized["message"] == data["message"]
assert serialized["organizations"] == data["organizations"]

def test_organization_selection_required_error_body_with_organization_round_trip(
self,
):
data = load_fixture(
"organization_selection_required_error_body_with_organization.json"
)
instance = OrganizationSelectionRequiredErrorBodyWithOrganization.from_dict(
data
)
serialized = instance.to_dict()
assert serialized == data
restored = OrganizationSelectionRequiredErrorBodyWithOrganization.from_dict(
serialized
)
assert restored.to_dict() == serialized

def test_organization_selection_required_error_body_with_organization_minimal_payload(
self,
):
data = {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}
instance = OrganizationSelectionRequiredErrorBodyWithOrganization.from_dict(
data
)
serialized = instance.to_dict()
assert serialized["id"] == data["id"]
assert serialized["name"] == data["name"]

def test_error_body_with_code_field_errors_round_trip(self):
data = load_fixture("error_body_with_code_field_errors.json")
instance = ErrorBodyWithCodeFieldErrors.from_dict(data)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from workos.sso.models import (
Connection,
ConnectionsConnectionType,
ConnectionsState,
CreateConnectionSAMLOptions,
PatchConnectionSAMLOptions,
Profile,
Expand Down Expand Up @@ -63,6 +64,7 @@ def test_list_connections_encodes_query_params(self, workos, httpx_mock):
domain="value domain/test",
organization_id="value organization_id/test",
search="value search/test",
state=ConnectionsState("active"),
)
request = httpx_mock.get_request()
assert request.url.params["limit"] == "10"
Expand All @@ -73,6 +75,7 @@ def test_list_connections_encodes_query_params(self, workos, httpx_mock):
assert request.url.params["domain"] == "value domain/test"
assert request.url.params["organization_id"] == "value organization_id/test"
assert request.url.params["search"] == "value search/test"
assert request.url.params["state"] == "active"

def test_create_connection(self, workos, httpx_mock):
httpx_mock.add_response(
Expand Down Expand Up @@ -420,6 +423,7 @@ async def test_list_connections_encodes_query_params(
domain="value domain/test",
organization_id="value organization_id/test",
search="value search/test",
state=ConnectionsState("active"),
)
request = httpx_mock.get_request()
assert request.url.params["limit"] == "10"
Expand All @@ -430,6 +434,7 @@ async def test_list_connections_encodes_query_params(
assert request.url.params["domain"] == "value domain/test"
assert request.url.params["organization_id"] == "value organization_id/test"
assert request.url.params["search"] == "value search/test"
assert request.url.params["state"] == "active"

@pytest.mark.asyncio
async def test_create_connection(self, async_workos, httpx_mock):
Expand Down
Loading