code: 41 ยท tests: 1 ยท manifest: 1
dotnet/.oagen-manifest.json|
@@ -37,6 +37,7 @@
|
|
| 37 |
"src/WorkOS.net/Entities/AgentRegistrationExpired.cs",
|
| 38 |
"src/WorkOS.net/Entities/AgentRegistrationOrganizationSwitched.cs",
|
| 39 |
"src/WorkOS.net/Entities/AgentRegistrationOrganizationSwitchedData.cs",
|
|
|
|
| 40 |
"src/WorkOS.net/Entities/AgentRegistrationRevoked.cs",
|
| 41 |
"src/WorkOS.net/Entities/ApiKey.cs",
|
| 42 |
"src/WorkOS.net/Entities/ApiKeyCreated.cs",
|
|
@@ -384,7 +385,6 @@
|
|
| 384 |
"src/WorkOS.net/Enums/ConnectionState.cs",
|
| 385 |
"src/WorkOS.net/Enums/ConnectionType.cs",
|
| 386 |
"src/WorkOS.net/Enums/ConnectionsConnectionType.cs",
|
| 387 |
-
"src/WorkOS.net/Enums/CreateDataIntegrationAuthMethods.cs",
|
| 388 |
"src/WorkOS.net/Enums/CreateUserInviteOptionsLocale.cs",
|
| 389 |
"src/WorkOS.net/Enums/CreateUserPasswordHashType.cs",
|
| 390 |
"src/WorkOS.net/Enums/CreateWebhookEndpointEvents.cs",
|
|
@@ -548,6 +548,9 @@
|
|
| 548 |
"test/WorkOSTests/testdata/agent_registration_organization_switched.json",
|
| 549 |
"test/WorkOSTests/testdata/agent_registration_organization_switched_data.json",
|
| 550 |
"test/WorkOSTests/testdata/agent_registration_organization_switched_nulls.json",
|
|
|
|
|
|
|
|
|
|
| 551 |
"test/WorkOSTests/testdata/agent_registration_revoked.json",
|
| 552 |
"test/WorkOSTests/testdata/agent_registration_revoked_data.json",
|
| 553 |
"test/WorkOSTests/testdata/agent_registration_revoked_nulls.json",
|
|
@@ -857,6 +860,8 @@
|
|
| 857 |
"test/WorkOSTests/testdata/data_integrations_list_response_data_nulls.json",
|
| 858 |
"test/WorkOSTests/testdata/data_integrations_upsert_api_key_request.json",
|
| 859 |
"test/WorkOSTests/testdata/data_integrations_upsert_api_key_request_nulls.json",
|
|
|
|
|
|
|
| 860 |
"test/WorkOSTests/testdata/data_integrations_vend_credentials_request.json",
|
| 861 |
"test/WorkOSTests/testdata/data_integrations_vend_credentials_request_nulls.json",
|
| 862 |
"test/WorkOSTests/testdata/decrypt_request.json",
|
|
@@ -1735,6 +1740,10 @@
|
|
| 1735 |
"sdkMethod": "AuthorizeDataIntegrationAsync",
|
| 1736 |
"service": "pipes"
|
| 1737 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1738 |
"POST /data-integrations/{slug}/credentials": {
|
| 1739 |
"sdkMethod": "CreateDataIntegrationCredentialAsync",
|
| 1740 |
"service": "pipes"
|
|
|
|
| 37 |
"src/WorkOS.net/Entities/AgentRegistrationExpired.cs",
|
| 38 |
"src/WorkOS.net/Entities/AgentRegistrationOrganizationSwitched.cs",
|
| 39 |
"src/WorkOS.net/Entities/AgentRegistrationOrganizationSwitchedData.cs",
|
| 40 |
+
"src/WorkOS.net/Entities/AgentRegistrationRefreshed.cs",
|
| 41 |
"src/WorkOS.net/Entities/AgentRegistrationRevoked.cs",
|
| 42 |
"src/WorkOS.net/Entities/ApiKey.cs",
|
| 43 |
"src/WorkOS.net/Entities/ApiKeyCreated.cs",
|
|
|
|
| 385 |
"src/WorkOS.net/Enums/ConnectionState.cs",
|
| 386 |
"src/WorkOS.net/Enums/ConnectionType.cs",
|
| 387 |
"src/WorkOS.net/Enums/ConnectionsConnectionType.cs",
|
|
|
|
| 388 |
"src/WorkOS.net/Enums/CreateUserInviteOptionsLocale.cs",
|
| 389 |
"src/WorkOS.net/Enums/CreateUserPasswordHashType.cs",
|
| 390 |
"src/WorkOS.net/Enums/CreateWebhookEndpointEvents.cs",
|
|
|
|
| 548 |
"test/WorkOSTests/testdata/agent_registration_organization_switched.json",
|
| 549 |
"test/WorkOSTests/testdata/agent_registration_organization_switched_data.json",
|
| 550 |
"test/WorkOSTests/testdata/agent_registration_organization_switched_nulls.json",
|
| 551 |
+
"test/WorkOSTests/testdata/agent_registration_refreshed.json",
|
| 552 |
+
"test/WorkOSTests/testdata/agent_registration_refreshed_data.json",
|
| 553 |
+
"test/WorkOSTests/testdata/agent_registration_refreshed_nulls.json",
|
| 554 |
"test/WorkOSTests/testdata/agent_registration_revoked.json",
|
| 555 |
"test/WorkOSTests/testdata/agent_registration_revoked_data.json",
|
| 556 |
"test/WorkOSTests/testdata/agent_registration_revoked_nulls.json",
|
|
|
|
| 860 |
"test/WorkOSTests/testdata/data_integrations_list_response_data_nulls.json",
|
| 861 |
"test/WorkOSTests/testdata/data_integrations_upsert_api_key_request.json",
|
| 862 |
"test/WorkOSTests/testdata/data_integrations_upsert_api_key_request_nulls.json",
|
| 863 |
+
"test/WorkOSTests/testdata/data_integrations_upsert_client_credentials_request.json",
|
| 864 |
+
"test/WorkOSTests/testdata/data_integrations_upsert_client_credentials_request_nulls.json",
|
| 865 |
"test/WorkOSTests/testdata/data_integrations_vend_credentials_request.json",
|
| 866 |
"test/WorkOSTests/testdata/data_integrations_vend_credentials_request_nulls.json",
|
| 867 |
"test/WorkOSTests/testdata/decrypt_request.json",
|
|
|
|
| 1740 |
"sdkMethod": "AuthorizeDataIntegrationAsync",
|
| 1741 |
"service": "pipes"
|
| 1742 |
},
|
| 1743 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1744 |
+
"sdkMethod": "UpdateDataIntegrationClientCredentialsAsync",
|
| 1745 |
+
"service": "pipes"
|
| 1746 |
+
},
|
| 1747 |
"POST /data-integrations/{slug}/credentials": {
|
| 1748 |
"sdkMethod": "CreateDataIntegrationCredentialAsync",
|
| 1749 |
"service": "pipes"
|
dotnet/src/WorkOS.net/Client/Utilities/EventSchemaDiscriminatorConverter.cs|
@@ -33,6 +33,7 @@ namespace WorkOS
|
|
| 33 |
case "agent.registration.deleted": target = new AgentRegistrationDeleted(); break;
|
| 34 |
case "agent.registration.expired": target = new AgentRegistrationExpired(); break;
|
| 35 |
case "agent.registration.organization.switched": target = new AgentRegistrationOrganizationSwitched(); break;
|
|
|
|
| 36 |
case "agent.registration.revoked": target = new AgentRegistrationRevoked(); break;
|
| 37 |
case "api_key.created": target = new ApiKeyCreated(); break;
|
| 38 |
case "api_key.revoked": target = new ApiKeyRevoked(); break;
|
|
|
|
| 33 |
case "agent.registration.deleted": target = new AgentRegistrationDeleted(); break;
|
| 34 |
case "agent.registration.expired": target = new AgentRegistrationExpired(); break;
|
| 35 |
case "agent.registration.organization.switched": target = new AgentRegistrationOrganizationSwitched(); break;
|
| 36 |
+
case "agent.registration.refreshed": target = new AgentRegistrationRefreshed(); break;
|
| 37 |
case "agent.registration.revoked": target = new AgentRegistrationRevoked(); break;
|
| 38 |
case "api_key.created": target = new ApiKeyCreated(); break;
|
| 39 |
case "api_key.revoked": target = new ApiKeyRevoked(); break;
|
dotnet/src/WorkOS.net/Entities/AgentRegistrationRefreshed.cs|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
namespace WorkOS
|
| 4 |
+
{
|
| 5 |
+
using System;
|
| 6 |
+
|
| 7 |
+
/// <summary>Represents an agent registration refreshed.</summary>
|
| 8 |
+
public class AgentRegistrationRefreshed : EventSchema
|
| 9 |
+
{
|
| 10 |
+
|
| 11 |
+
/// <summary>The event payload.</summary>
|
| 12 |
+
public new AgentRegistrationDeletedData Data { get; set; } = default!;
|
| 13 |
+
public new EventContext? Context { get; set; }
|
| 14 |
+
}
|
| 15 |
+
}
|
dotnet/src/WorkOS.net/Entities/ConnectedAccount.cs|
@@ -31,6 +31,15 @@ namespace WorkOS
|
|
| 31 |
/// <summary>The last four characters of the API key, or `null` for OAuth connections.</summary>
|
| 32 |
public string? ApiKeyLast4 { get; set; }
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
/// <summary>The state of the connected account:</summary>
|
| 35 |
/// <remarks>
|
| 36 |
/// - `connected`: The connection is active and tokens are valid.
|
|
|
|
| 31 |
/// <summary>The last four characters of the API key, or `null` for OAuth connections.</summary>
|
| 32 |
public string? ApiKeyLast4 { get; set; }
|
| 33 |
|
| 34 |
+
/// <summary>The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.</summary>
|
| 35 |
+
public string? ClientId { get; set; }
|
| 36 |
+
|
| 37 |
+
/// <summary>The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.</summary>
|
| 38 |
+
public string? ClientSecretLast4 { get; set; }
|
| 39 |
+
|
| 40 |
+
/// <summary>The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.</summary>
|
| 41 |
+
public Dictionary<string, string>? Config { get; set; }
|
| 42 |
+
|
| 43 |
/// <summary>The state of the connected account:</summary>
|
| 44 |
/// <remarks>
|
| 45 |
/// - `connected`: The connection is active and tokens are valid.
|
dotnet/src/WorkOS.net/Entities/CustomProviderDefinition.cs|
@@ -11,11 +11,11 @@ namespace WorkOS
|
|
| 11 |
/// <summary>A descriptive name for the custom provider.</summary>
|
| 12 |
public string Name { get; set; } = default!;
|
| 13 |
|
| 14 |
-
/// <summary>The provider's OAuth authorization endpoint.</summary>
|
| 15 |
-
public string AuthorizationUrl { get; set; }
|
| 16 |
|
| 17 |
-
/// <summary>The provider's OAuth token endpoint.</summary>
|
| 18 |
-
public string TokenUrl { get; set; }
|
| 19 |
|
| 20 |
/// <summary>The endpoint used to refresh tokens, if different from the token endpoint.</summary>
|
| 21 |
public string? RefreshTokenUrl { get; set; }
|
|
|
|
| 11 |
/// <summary>A descriptive name for the custom provider.</summary>
|
| 12 |
public string Name { get; set; } = default!;
|
| 13 |
|
| 14 |
+
/// <summary>The provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers.</summary>
|
| 15 |
+
public string? AuthorizationUrl { get; set; }
|
| 16 |
|
| 17 |
+
/// <summary>The provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers.</summary>
|
| 18 |
+
public string? TokenUrl { get; set; }
|
| 19 |
|
| 20 |
/// <summary>The endpoint used to refresh tokens, if different from the token endpoint.</summary>
|
| 21 |
public string? RefreshTokenUrl { get; set; }
|
dotnet/src/WorkOS.net/Entities/DataIntegration.cs|
@@ -43,8 +43,8 @@ namespace WorkOS
|
|
| 43 |
/// <summary>How accounts authenticate with the provider for this Data Integration.</summary>
|
| 44 |
public List<ConnectedAccountAuthMethod> AuthMethods { get; set; } = default!;
|
| 45 |
|
| 46 |
-
/// <summary>The credentials
|
| 47 |
-
public DataIntegrationCredential Credentials { get; set; }
|
| 48 |
|
| 49 |
/// <summary>The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.</summary>
|
| 50 |
public DataIntegrationInstallation? Installation { get; set; }
|
|
|
|
| 43 |
/// <summary>How accounts authenticate with the provider for this Data Integration.</summary>
|
| 44 |
public List<ConnectedAccountAuthMethod> AuthMethods { get; set; } = default!;
|
| 45 |
|
| 46 |
+
/// <summary>The integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant).</summary>
|
| 47 |
+
public DataIntegrationCredential? Credentials { get; set; }
|
| 48 |
|
| 49 |
/// <summary>The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.</summary>
|
| 50 |
public DataIntegrationInstallation? Installation { get; set; }
|
dotnet/src/WorkOS.net/Entities/DataIntegrationCredential.cs|
@@ -5,7 +5,7 @@ namespace WorkOS
|
|
| 5 |
using Newtonsoft.Json;
|
| 6 |
using STJS = System.Text.Json.Serialization;
|
| 7 |
|
| 8 |
-
/// <summary>
|
| 9 |
public class DataIntegrationCredential
|
| 10 |
{
|
| 11 |
|
|
|
|
| 5 |
using Newtonsoft.Json;
|
| 6 |
using STJS = System.Text.Json.Serialization;
|
| 7 |
|
| 8 |
+
/// <summary>Represents a data integration credential.</summary>
|
| 9 |
public class DataIntegrationCredential
|
| 10 |
{
|
| 11 |
|
dotnet/src/WorkOS.net/Entities/DataIntegrationsListResponseDataConnectedAccount.cs|
@@ -31,6 +31,15 @@ namespace WorkOS
|
|
| 31 |
/// <summary>The last four characters of the API key, or `null` for OAuth connections.</summary>
|
| 32 |
public string? ApiKeyLast4 { get; set; }
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
/// <summary>The state of the connected account:</summary>
|
| 35 |
/// <remarks>
|
| 36 |
/// - `connected`: The connection is active and tokens are valid.
|
|
|
|
| 31 |
/// <summary>The last four characters of the API key, or `null` for OAuth connections.</summary>
|
| 32 |
public string? ApiKeyLast4 { get; set; }
|
| 33 |
|
| 34 |
+
/// <summary>The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.</summary>
|
| 35 |
+
public string? ClientId { get; set; }
|
| 36 |
+
|
| 37 |
+
/// <summary>The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.</summary>
|
| 38 |
+
public string? ClientSecretLast4 { get; set; }
|
| 39 |
+
|
| 40 |
+
/// <summary>The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.</summary>
|
| 41 |
+
public Dictionary<string, string>? Config { get; set; }
|
| 42 |
+
|
| 43 |
/// <summary>The state of the connected account:</summary>
|
| 44 |
/// <remarks>
|
| 45 |
/// - `connected`: The connection is active and tokens are valid.
|
dotnet/src/WorkOS.net/Entities/RadarSmsChallengeCodeSessionAuthenticateRequest.cs|
@@ -17,11 +17,11 @@ namespace WorkOS
|
|
| 17 |
/// <summary>The one-time code from the Radar SMS challenge.</summary>
|
| 18 |
public string Code { get; set; } = default!;
|
| 19 |
|
| 20 |
-
/// <summary>The ID of the Radar SMS verification being confirmed.</summary>
|
| 21 |
-
public string VerificationId { get; set; }
|
| 22 |
|
| 23 |
-
/// <summary>The phone number the Radar SMS challenge was sent to.</summary>
|
| 24 |
-
public string PhoneNumber { get; set; }
|
| 25 |
|
| 26 |
/// <summary>The pending authentication token from a previous authentication attempt.</summary>
|
| 27 |
public string PendingAuthenticationToken { get; set; } = default!;
|
|
|
|
| 17 |
/// <summary>The one-time code from the Radar SMS challenge.</summary>
|
| 18 |
public string Code { get; set; } = default!;
|
| 19 |
|
| 20 |
+
/// <summary>The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.</summary>
|
| 21 |
+
public string? VerificationId { get; set; }
|
| 22 |
|
| 23 |
+
/// <summary>The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.</summary>
|
| 24 |
+
public string? PhoneNumber { get; set; }
|
| 25 |
|
| 26 |
/// <summary>The pending authentication token from a previous authentication attempt.</summary>
|
| 27 |
public string PendingAuthenticationToken { get; set; } = default!;
|
dotnet/src/WorkOS.net/Entities/WaitlistUser.cs|
@@ -27,6 +27,9 @@ namespace WorkOS
|
|
| 27 |
/// <summary>The timestamp when the Waitlist User was approved, or null if not yet approved.</summary>
|
| 28 |
public DateTimeOffset? ApprovedAt { get; set; }
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
/// <summary>An ISO 8601 timestamp.</summary>
|
| 31 |
public DateTimeOffset CreatedAt { get; set; }
|
| 32 |
|
|
|
|
| 27 |
/// <summary>The timestamp when the Waitlist User was approved, or null if not yet approved.</summary>
|
| 28 |
public DateTimeOffset? ApprovedAt { get; set; }
|
| 29 |
|
| 30 |
+
/// <summary>The unique ID of the Waitlist that the Waitlist User joined.</summary>
|
| 31 |
+
public string? WaitlistId { get; set; }
|
| 32 |
+
|
| 33 |
/// <summary>An ISO 8601 timestamp.</summary>
|
| 34 |
public DateTimeOffset CreatedAt { get; set; }
|
| 35 |
|
dotnet/src/WorkOS.net/Enums/AuthenticateResponseAuthenticationMethod.cs|
@@ -36,6 +36,10 @@ namespace WorkOS
|
|
| 36 |
GitLabOAuth,
|
| 37 |
[EnumMember(Value = "GoogleOAuth")]
|
| 38 |
GoogleOAuth,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
[EnumMember(Value = "IntuitOAuth")]
|
| 40 |
IntuitOAuth,
|
| 41 |
[EnumMember(Value = "LinkedInOAuth")]
|
|
|
|
| 36 |
GitLabOAuth,
|
| 37 |
[EnumMember(Value = "GoogleOAuth")]
|
| 38 |
GoogleOAuth,
|
| 39 |
+
[EnumMember(Value = "GrokOAuth")]
|
| 40 |
+
GrokOAuth,
|
| 41 |
+
[EnumMember(Value = "XOAuth")]
|
| 42 |
+
XoAuth,
|
| 43 |
[EnumMember(Value = "IntuitOAuth")]
|
| 44 |
IntuitOAuth,
|
| 45 |
[EnumMember(Value = "LinkedInOAuth")]
|
dotnet/src/WorkOS.net/Enums/ConnectionActivatedDataConnectionType.cs|
@@ -58,6 +58,10 @@ namespace WorkOS
|
|
| 58 |
GoogleOidc,
|
| 59 |
[EnumMember(Value = "GoogleSAML")]
|
| 60 |
GoogleSAML,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
[EnumMember(Value = "IntuitOAuth")]
|
| 62 |
IntuitOAuth,
|
| 63 |
[EnumMember(Value = "JumpCloudSAML")]
|
|
|
|
| 58 |
GoogleOidc,
|
| 59 |
[EnumMember(Value = "GoogleSAML")]
|
| 60 |
GoogleSAML,
|
| 61 |
+
[EnumMember(Value = "GrokOAuth")]
|
| 62 |
+
GrokOAuth,
|
| 63 |
+
[EnumMember(Value = "XOAuth")]
|
| 64 |
+
XoAuth,
|
| 65 |
[EnumMember(Value = "IntuitOAuth")]
|
| 66 |
IntuitOAuth,
|
| 67 |
[EnumMember(Value = "JumpCloudSAML")]
|
dotnet/src/WorkOS.net/Enums/ConnectionType.cs|
@@ -60,6 +60,10 @@ namespace WorkOS
|
|
| 60 |
GoogleOidc,
|
| 61 |
[EnumMember(Value = "GoogleSAML")]
|
| 62 |
GoogleSAML,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
[EnumMember(Value = "IntuitOAuth")]
|
| 64 |
IntuitOAuth,
|
| 65 |
[EnumMember(Value = "JumpCloudSAML")]
|
|
|
|
| 60 |
GoogleOidc,
|
| 61 |
[EnumMember(Value = "GoogleSAML")]
|
| 62 |
GoogleSAML,
|
| 63 |
+
[EnumMember(Value = "GrokOAuth")]
|
| 64 |
+
GrokOAuth,
|
| 65 |
+
[EnumMember(Value = "XOAuth")]
|
| 66 |
+
XoAuth,
|
| 67 |
[EnumMember(Value = "IntuitOAuth")]
|
| 68 |
IntuitOAuth,
|
| 69 |
[EnumMember(Value = "JumpCloudSAML")]
|
dotnet/src/WorkOS.net/Enums/ConnectionsConnectionType.cs|
@@ -56,6 +56,10 @@ namespace WorkOS
|
|
| 56 |
GoogleOidc,
|
| 57 |
[EnumMember(Value = "GoogleSAML")]
|
| 58 |
GoogleSAML,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
[EnumMember(Value = "IntuitOAuth")]
|
| 60 |
IntuitOAuth,
|
| 61 |
[EnumMember(Value = "JumpCloudSAML")]
|
|
|
|
| 56 |
GoogleOidc,
|
| 57 |
[EnumMember(Value = "GoogleSAML")]
|
| 58 |
GoogleSAML,
|
| 59 |
+
[EnumMember(Value = "GrokOAuth")]
|
| 60 |
+
GrokOAuth,
|
| 61 |
+
[EnumMember(Value = "XOAuth")]
|
| 62 |
+
XoAuth,
|
| 63 |
[EnumMember(Value = "IntuitOAuth")]
|
| 64 |
IntuitOAuth,
|
| 65 |
[EnumMember(Value = "JumpCloudSAML")]
|
dotnet/src/WorkOS.net/Enums/CreateDataIntegrationAuthMethods.cs|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
-
|
| 3 |
-
namespace WorkOS
|
| 4 |
-
{
|
| 5 |
-
using System.Runtime.Serialization;
|
| 6 |
-
using Newtonsoft.Json;
|
| 7 |
-
using STJS = System.Text.Json.Serialization;
|
| 8 |
-
|
| 9 |
-
/// <summary>Represents create data integration auth methods values.</summary>
|
| 10 |
-
[JsonConverter(typeof(WorkOSNewtonsoftStringEnumConverter))]
|
| 11 |
-
[STJS.JsonConverter(typeof(WorkOSStringEnumConverterFactory))]
|
| 12 |
-
public enum CreateDataIntegrationAuthMethods
|
| 13 |
-
{
|
| 14 |
-
[EnumMember(Value = "unknown")]
|
| 15 |
-
Unknown,
|
| 16 |
-
|
| 17 |
-
[EnumMember(Value = "oauth")]
|
| 18 |
-
OAuth,
|
| 19 |
-
[EnumMember(Value = "api_key")]
|
| 20 |
-
ApiKey,
|
| 21 |
-
}
|
| 22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dotnet/src/WorkOS.net/Enums/CreateWebhookEndpointEvents.cs|
@@ -24,6 +24,8 @@ namespace WorkOS
|
|
| 24 |
AgentRegistrationCredentialIssued,
|
| 25 |
[EnumMember(Value = "agent.registration.deleted")]
|
| 26 |
AgentRegistrationDeleted,
|
|
|
|
|
|
|
| 27 |
[EnumMember(Value = "agent.registration.expired")]
|
| 28 |
AgentRegistrationExpired,
|
| 29 |
[EnumMember(Value = "agent.registration.organization.switched")]
|
|
|
|
| 24 |
AgentRegistrationCredentialIssued,
|
| 25 |
[EnumMember(Value = "agent.registration.deleted")]
|
| 26 |
AgentRegistrationDeleted,
|
| 27 |
+
[EnumMember(Value = "agent.registration.refreshed")]
|
| 28 |
+
AgentRegistrationRefreshed,
|
| 29 |
[EnumMember(Value = "agent.registration.expired")]
|
| 30 |
AgentRegistrationExpired,
|
| 31 |
[EnumMember(Value = "agent.registration.organization.switched")]
|
dotnet/src/WorkOS.net/Enums/UserIdentitiesGetItemProvider.cs|
@@ -26,6 +26,10 @@ namespace WorkOS
|
|
| 26 |
GitLabOAuth,
|
| 27 |
[EnumMember(Value = "GoogleOAuth")]
|
| 28 |
GoogleOAuth,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
[EnumMember(Value = "IntuitOAuth")]
|
| 30 |
IntuitOAuth,
|
| 31 |
[EnumMember(Value = "LinkedInOAuth")]
|
|
|
|
| 26 |
GitLabOAuth,
|
| 27 |
[EnumMember(Value = "GoogleOAuth")]
|
| 28 |
GoogleOAuth,
|
| 29 |
+
[EnumMember(Value = "GrokOAuth")]
|
| 30 |
+
GrokOAuth,
|
| 31 |
+
[EnumMember(Value = "XOAuth")]
|
| 32 |
+
XoAuth,
|
| 33 |
[EnumMember(Value = "IntuitOAuth")]
|
| 34 |
IntuitOAuth,
|
| 35 |
[EnumMember(Value = "LinkedInOAuth")]
|
dotnet/src/WorkOS.net/Services/Pipes/PipesService.cs|
@@ -55,7 +55,7 @@ namespace WorkOS
|
|
| 55 |
|
| 56 |
/// <summary>Create a data integration</summary>
|
| 57 |
/// <remarks>
|
| 58 |
-
/// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 59 |
/// </remarks>
|
| 60 |
/// <param name="options">Request options.</param>
|
| 61 |
/// <param name="requestOptions">Per-request configuration overrides.</param>
|
|
@@ -169,6 +169,26 @@ namespace WorkOS
|
|
| 169 |
return this.AuthorizeDataIntegrationAsync(slug, options, requestOptions, cancellationToken);
|
| 170 |
}
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
/// <summary>Vend credentials for a connected account</summary>
|
| 173 |
/// <remarks>
|
| 174 |
/// Returns credentials for a user's connected account. Branches on the installation's `auth_method`: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.
|
|
|
|
| 55 |
|
| 56 |
/// <summary>Create a data integration</summary>
|
| 57 |
/// <remarks>
|
| 58 |
+
/// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 59 |
/// </remarks>
|
| 60 |
/// <param name="options">Request options.</param>
|
| 61 |
/// <param name="requestOptions">Per-request configuration overrides.</param>
|
|
|
|
| 169 |
return this.AuthorizeDataIntegrationAsync(slug, options, requestOptions, cancellationToken);
|
| 170 |
}
|
| 171 |
|
| 172 |
+
/// <summary>Upsert client credentials for a connected account</summary>
|
| 173 |
+
/// <remarks>
|
| 174 |
+
/// Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 175 |
+
/// </remarks>
|
| 176 |
+
/// <param name="slug">The identifier of the integration.</param>
|
| 177 |
+
/// <param name="options">Request options.</param>
|
| 178 |
+
/// <param name="requestOptions">Per-request configuration overrides.</param>
|
| 179 |
+
/// <param name="cancellationToken">Cancellation token.</param>
|
| 180 |
+
/// <returns>The <see cref="ConnectedAccount"/> result.</returns>
|
| 181 |
+
public virtual async Task<ConnectedAccount> UpdateDataIntegrationClientCredentialsAsync(string slug, PipesUpdateDataIntegrationClientCredentialsOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
|
| 182 |
+
{
|
| 183 |
+
return await this.PutAsync<ConnectedAccount>($"/data-integrations/{Uri.EscapeDataString(slug)}/client-credentials", options, requestOptions, cancellationToken);
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
/// <summary>Compatibility wrapper for <see cref="UpdateDataIntegrationClientCredentialsAsync"/>.</summary>
|
| 187 |
+
public virtual Task<ConnectedAccount> UpdateDataIntegrationClientCredentials(string slug, PipesUpdateDataIntegrationClientCredentialsOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
|
| 188 |
+
{
|
| 189 |
+
return this.UpdateDataIntegrationClientCredentialsAsync(slug, options, requestOptions, cancellationToken);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
/// <summary>Vend credentials for a connected account</summary>
|
| 193 |
/// <remarks>
|
| 194 |
/// Returns credentials for a user's connected account. Branches on the installation's `auth_method`: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.
|
dotnet/src/WorkOS.net/Services/Pipes/_interfaces/PipesOptions.cs|
@@ -27,8 +27,8 @@ namespace WorkOS
|
|
| 27 |
/// <summary>The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.</summary>
|
| 28 |
public List<string>? Scopes { get; set; }
|
| 29 |
|
| 30 |
-
/// <summary>How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).</summary>
|
| 31 |
-
public List<
|
| 32 |
|
| 33 |
/// <summary>Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.</summary>
|
| 34 |
public Dictionary<string, string>? Config { get; set; }
|
|
@@ -98,6 +98,26 @@ namespace WorkOS
|
|
| 98 |
|
| 99 |
}
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
/// <summary>Request options for <see cref="PipesService.CreateDataIntegrationCredentialAsync"/>: Vend credentials for a connected account</summary>
|
| 102 |
public class PipesCreateDataIntegrationCredentialOptions : BaseOptions
|
| 103 |
{
|
|
|
|
| 27 |
/// <summary>The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.</summary>
|
| 28 |
public List<string>? Scopes { get; set; }
|
| 29 |
|
| 30 |
+
/// <summary>How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.</summary>
|
| 31 |
+
public List<ConnectedAccountAuthMethod>? AuthMethods { get; set; }
|
| 32 |
|
| 33 |
/// <summary>Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.</summary>
|
| 34 |
public Dictionary<string, string>? Config { get; set; }
|
|
|
|
| 98 |
|
| 99 |
}
|
| 100 |
|
| 101 |
+
/// <summary>Request options for <see cref="PipesService.UpdateDataIntegrationClientCredentialsAsync"/>: Upsert client credentials for a connected account</summary>
|
| 102 |
+
public class PipesUpdateDataIntegrationClientCredentialsOptions : BaseOptions
|
| 103 |
+
{
|
| 104 |
+
/// <summary>A [User](https://workos.com/docs/reference/authkit/user) identifier.</summary>
|
| 105 |
+
public string UserId { get; set; } = default!;
|
| 106 |
+
|
| 107 |
+
/// <summary>An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.</summary>
|
| 108 |
+
public string? OrganizationId { get; set; }
|
| 109 |
+
|
| 110 |
+
/// <summary>The OAuth client ID to store for this integration.</summary>
|
| 111 |
+
public string ClientId { get; set; } = default!;
|
| 112 |
+
|
| 113 |
+
/// <summary>The OAuth client secret to store for this integration.</summary>
|
| 114 |
+
public string ClientSecret { get; set; } = default!;
|
| 115 |
+
|
| 116 |
+
/// <summary>Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.</summary>
|
| 117 |
+
public Dictionary<string, string>? Config { get; set; }
|
| 118 |
+
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
/// <summary>Request options for <see cref="PipesService.CreateDataIntegrationCredentialAsync"/>: Vend credentials for a connected account</summary>
|
| 122 |
public class PipesCreateDataIntegrationCredentialOptions : BaseOptions
|
| 123 |
{
|
dotnet/src/WorkOS.net/Services/UserManagement/_interfaces/UserManagementWrapperOptions.cs|
@@ -252,11 +252,11 @@ namespace WorkOS
|
|
| 252 |
/// <summary>The one-time code from the Radar SMS challenge.</summary>
|
| 253 |
public string Code { get; set; } = default!;
|
| 254 |
|
| 255 |
-
/// <summary>The ID of the Radar SMS verification being confirmed.</summary>
|
| 256 |
-
public string VerificationId { get; set; }
|
| 257 |
|
| 258 |
-
/// <summary>The phone number the Radar SMS challenge was sent to.</summary>
|
| 259 |
-
public string PhoneNumber { get; set; }
|
| 260 |
|
| 261 |
/// <summary>The pending authentication token from a previous authentication attempt.</summary>
|
| 262 |
public string PendingAuthenticationToken { get; set; } = default!;
|
|
|
|
| 252 |
/// <summary>The one-time code from the Radar SMS challenge.</summary>
|
| 253 |
public string Code { get; set; } = default!;
|
| 254 |
|
| 255 |
+
/// <summary>The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.</summary>
|
| 256 |
+
public string? VerificationId { get; set; }
|
| 257 |
|
| 258 |
+
/// <summary>The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.</summary>
|
| 259 |
+
public string? PhoneNumber { get; set; }
|
| 260 |
|
| 261 |
/// <summary>The pending authentication token from a previous authentication attempt.</summary>
|
| 262 |
public string PendingAuthenticationToken { get; set; } = default!;
|
dotnet/test/WorkOSTests/Tests/PipesServiceTest.cs|
@@ -128,6 +128,24 @@ namespace WorkOSTests
|
|
| 128 |
await this.httpMock.AssertRequestBodyContainsAsync("user_id", "test_user_id");
|
| 129 |
}
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
[Fact]
|
| 132 |
public async Task TestCreateDataIntegrationCredentialAsync()
|
| 133 |
{
|
|
|
|
| 128 |
await this.httpMock.AssertRequestBodyContainsAsync("user_id", "test_user_id");
|
| 129 |
}
|
| 130 |
|
| 131 |
+
[Fact]
|
| 132 |
+
public async Task TestUpdateDataIntegrationClientCredentialsAsync()
|
| 133 |
+
{
|
| 134 |
+
var fixture = System.IO.File.ReadAllText("testdata/connected_account.json");
|
| 135 |
+
this.httpMock.MockResponse(HttpMethod.Put, "/data-integrations/test_slug/client-credentials", HttpStatusCode.OK, fixture);
|
| 136 |
+
var options = new PipesUpdateDataIntegrationClientCredentialsOptions();
|
| 137 |
+
options.UserId = "test_user_id";
|
| 138 |
+
options.ClientId = "test_client_id";
|
| 139 |
+
var result = await this.service.UpdateDataIntegrationClientCredentialsAsync("test_slug", options);
|
| 140 |
+
Assert.NotNull(result);
|
| 141 |
+
Assert.Equal("data_installation_01EHZNVPK3SFK441A1RGBFSHRT", result.Id);
|
| 142 |
+
Assert.Equal("2024-01-16T14:20:00.000Z", result.CreatedAt);
|
| 143 |
+
Assert.Equal("2024-01-16T14:20:00.000Z", result.UpdatedAt);
|
| 144 |
+
this.httpMock.AssertRequestWasMade(HttpMethod.Put, "/data-integrations/test_slug/client-credentials");
|
| 145 |
+
await this.httpMock.AssertRequestBodyContainsAsync("user_id", "test_user_id");
|
| 146 |
+
await this.httpMock.AssertRequestBodyContainsAsync("client_id", "test_client_id");
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
[Fact]
|
| 150 |
public async Task TestCreateDataIntegrationCredentialAsync()
|
| 151 |
{
|
dotnet/test/WorkOSTests/testdata/agent_registration_refreshed.json|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
+
"context": {
|
| 10 |
+
"google_analytics_client_id": "GA1.2.1234567890.1234567890",
|
| 11 |
+
"google_analytics_sessions": [
|
| 12 |
+
{
|
| 13 |
+
"containerId": "GTM-ABCDEF",
|
| 14 |
+
"sessionId": "1234567890",
|
| 15 |
+
"sessionNumber": "1"
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 19 |
+
"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 20 |
+
"actor": {
|
| 21 |
+
"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 22 |
+
"source": "api",
|
| 23 |
+
"name": "Jane Doe"
|
| 24 |
+
},
|
| 25 |
+
"previous_attributes": {
|
| 26 |
+
"key": {}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
dotnet/test/WorkOSTests/testdata/agent_registration_refreshed_data.json|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 3 |
+
}
|
dotnet/test/WorkOSTests/testdata/agent_registration_refreshed_nulls.json|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
+
"context": null
|
| 10 |
+
}
|
dotnet/test/WorkOSTests/testdata/connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
dotnet/test/WorkOSTests/testdata/connected_account_nulls.json|
@@ -9,6 +9,9 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": null,
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": null,
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": null,
|
| 13 |
+
"client_secret_last_4": null,
|
| 14 |
+
"config": null,
|
| 15 |
"state": "connected",
|
| 16 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 17 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
dotnet/test/WorkOSTests/testdata/custom_provider_definition_nulls.json|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"name": "My OAuth App",
|
| 3 |
-
"authorization_url":
|
| 4 |
-
"token_url":
|
| 5 |
"refresh_token_url": null,
|
| 6 |
"pkce_enabled": null,
|
| 7 |
"request_scope_separator": null,
|
|
|
|
| 1 |
{
|
| 2 |
"name": "My OAuth App",
|
| 3 |
+
"authorization_url": null,
|
| 4 |
+
"token_url": null,
|
| 5 |
"refresh_token_url": null,
|
| 6 |
"pkce_enabled": null,
|
| 7 |
"request_scope_separator": null,
|
dotnet/test/WorkOSTests/testdata/data_integration_nulls.json|
@@ -11,11 +11,7 @@
|
|
| 11 |
"auth_methods": [
|
| 12 |
"oauth"
|
| 13 |
],
|
| 14 |
-
"credentials":
|
| 15 |
-
"type": "custom",
|
| 16 |
-
"client_id": "Iv1.abc123",
|
| 17 |
-
"redacted_client_secret": "6789"
|
| 18 |
-
},
|
| 19 |
"installation": null,
|
| 20 |
"config": {
|
| 21 |
"account_identifier": "acme-prod"
|
|
|
|
| 11 |
"auth_methods": [
|
| 12 |
"oauth"
|
| 13 |
],
|
| 14 |
+
"credentials": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"installation": null,
|
| 16 |
"config": {
|
| 17 |
"account_identifier": "acme-prod"
|
dotnet/test/WorkOSTests/testdata/data_integrations_list_response.json|
@@ -30,6 +30,11 @@
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
"state": "connected",
|
| 34 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 35 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
| 33 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 34 |
+
"client_secret_last_4": "cdef",
|
| 35 |
+
"config": {
|
| 36 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 37 |
+
},
|
| 38 |
"state": "connected",
|
| 39 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 40 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
dotnet/test/WorkOSTests/testdata/data_integrations_list_response_data.json|
@@ -27,6 +27,11 @@
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"state": "connected",
|
| 31 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 32 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
| 30 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 31 |
+
"client_secret_last_4": "cdef",
|
| 32 |
+
"config": {
|
| 33 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 34 |
+
},
|
| 35 |
"state": "connected",
|
| 36 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 37 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
dotnet/test/WorkOSTests/testdata/data_integrations_list_response_data_connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
dotnet/test/WorkOSTests/testdata/data_integrations_list_response_data_connected_account_nulls.json|
@@ -9,6 +9,9 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": null,
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": null,
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": null,
|
| 13 |
+
"client_secret_last_4": null,
|
| 14 |
+
"config": null,
|
| 15 |
"state": "connected",
|
| 16 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 17 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
dotnet/test/WorkOSTests/testdata/data_integrations_upsert_client_credentials_request.json|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"client_id": "3MVG9...",
|
| 5 |
+
"client_secret": "shhh-secret",
|
| 6 |
+
"config": {
|
| 7 |
+
"mydomain": "acme"
|
| 8 |
+
}
|
| 9 |
+
}
|
dotnet/test/WorkOSTests/testdata/data_integrations_upsert_client_credentials_request_nulls.json|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"organization_id": null,
|
| 4 |
+
"client_id": "3MVG9...",
|
| 5 |
+
"client_secret": "shhh-secret",
|
| 6 |
+
"config": null
|
| 7 |
+
}
|
dotnet/test/WorkOSTests/testdata/radar_sms_challenge_code_session_authenticate_request_nulls.json|
@@ -3,8 +3,8 @@
|
|
| 3 |
"client_secret": "sk_test_....",
|
| 4 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 5 |
"code": "123456",
|
| 6 |
-
"verification_id":
|
| 7 |
-
"phone_number":
|
| 8 |
"pending_authentication_token": "cTDQJTTkTkkVYxbn...",
|
| 9 |
"ip_address": null,
|
| 10 |
"device_id": null,
|
|
|
|
| 3 |
"client_secret": "sk_test_....",
|
| 4 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 5 |
"code": "123456",
|
| 6 |
+
"verification_id": null,
|
| 7 |
+
"phone_number": null,
|
| 8 |
"pending_authentication_token": "cTDQJTTkTkkVYxbn...",
|
| 9 |
"ip_address": null,
|
| 10 |
"device_id": null,
|
dotnet/test/WorkOSTests/testdata/waitlist_user.json|
@@ -4,6 +4,7 @@
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
|
|
|
| 7 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 8 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
}
|
|
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
| 7 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 8 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 10 |
}
|
dotnet/test/WorkOSTests/testdata/waitlist_user_approved.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_approved_nulls.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_created.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_created_nulls.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_denied.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_denied_nulls.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
dotnet/test/WorkOSTests/testdata/waitlist_user_nulls.json|
@@ -4,6 +4,7 @@
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
|
|
|
| 7 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 8 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
}
|
|
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
| 7 |
+
"waitlist_id": null,
|
| 8 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 10 |
}
|
All files in this language are hidden by the current filters.
code: 15 ยท tests: 1 ยท manifest: 1
go/.oagen-manifest.json|
@@ -75,6 +75,7 @@
|
|
| 75 |
"testdata/agent_registration_expired.json",
|
| 76 |
"testdata/agent_registration_organization_switched.json",
|
| 77 |
"testdata/agent_registration_organization_switched_data.json",
|
|
|
|
| 78 |
"testdata/agent_registration_revoked.json",
|
| 79 |
"testdata/api_key.json",
|
| 80 |
"testdata/api_key_created.json",
|
|
@@ -110,7 +111,6 @@
|
|
| 110 |
"testdata/audit_logs_retention.json",
|
| 111 |
"testdata/auth_method_mismatch_error.json",
|
| 112 |
"testdata/authenticate_response.json",
|
| 113 |
-
"testdata/authenticate_response_impersonator.json",
|
| 114 |
"testdata/authenticate_response_oauth_token.json",
|
| 115 |
"testdata/authentication_challenge.json",
|
| 116 |
"testdata/authentication_challenge_verify_response.json",
|
|
@@ -171,7 +171,6 @@
|
|
| 171 |
"testdata/client_api_token.json",
|
| 172 |
"testdata/client_api_token_response.json",
|
| 173 |
"testdata/configure_data_integration_body.json",
|
| 174 |
-
"testdata/confirm_email_change.json",
|
| 175 |
"testdata/connect_application.json",
|
| 176 |
"testdata/connect_application_m2m.json",
|
| 177 |
"testdata/connect_application_oauth.json",
|
|
@@ -242,6 +241,7 @@
|
|
| 242 |
"testdata/data_integrations_list_response_data.json",
|
| 243 |
"testdata/data_integrations_list_response_data_connected_account.json",
|
| 244 |
"testdata/data_integrations_upsert_api_key_request.json",
|
|
|
|
| 245 |
"testdata/data_integrations_vend_credentials_request.json",
|
| 246 |
"testdata/decrypt_request.json",
|
| 247 |
"testdata/decrypt_response.json",
|
|
@@ -498,7 +498,6 @@
|
|
| 498 |
"testdata/user_role_assignment_resource.json",
|
| 499 |
"testdata/user_role_assignment_source.json",
|
| 500 |
"testdata/user_sessions_impersonator.json",
|
| 501 |
-
"testdata/user_sessions_list_item.json",
|
| 502 |
"testdata/user_updated.json",
|
| 503 |
"testdata/validate_api_key.json",
|
| 504 |
"testdata/vault_byok_key_deleted.json",
|
|
@@ -839,6 +838,10 @@
|
|
| 839 |
"sdkMethod": "AuthorizeDataIntegration",
|
| 840 |
"service": "pipes"
|
| 841 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
"POST /data-integrations/{slug}/credentials": {
|
| 843 |
"sdkMethod": "CreateDataIntegrationCredential",
|
| 844 |
"service": "pipes"
|
|
|
|
| 75 |
"testdata/agent_registration_expired.json",
|
| 76 |
"testdata/agent_registration_organization_switched.json",
|
| 77 |
"testdata/agent_registration_organization_switched_data.json",
|
| 78 |
+
"testdata/agent_registration_refreshed.json",
|
| 79 |
"testdata/agent_registration_revoked.json",
|
| 80 |
"testdata/api_key.json",
|
| 81 |
"testdata/api_key_created.json",
|
|
|
|
| 111 |
"testdata/audit_logs_retention.json",
|
| 112 |
"testdata/auth_method_mismatch_error.json",
|
| 113 |
"testdata/authenticate_response.json",
|
|
|
|
| 114 |
"testdata/authenticate_response_oauth_token.json",
|
| 115 |
"testdata/authentication_challenge.json",
|
| 116 |
"testdata/authentication_challenge_verify_response.json",
|
|
|
|
| 171 |
"testdata/client_api_token.json",
|
| 172 |
"testdata/client_api_token_response.json",
|
| 173 |
"testdata/configure_data_integration_body.json",
|
|
|
|
| 174 |
"testdata/connect_application.json",
|
| 175 |
"testdata/connect_application_m2m.json",
|
| 176 |
"testdata/connect_application_oauth.json",
|
|
|
|
| 241 |
"testdata/data_integrations_list_response_data.json",
|
| 242 |
"testdata/data_integrations_list_response_data_connected_account.json",
|
| 243 |
"testdata/data_integrations_upsert_api_key_request.json",
|
| 244 |
+
"testdata/data_integrations_upsert_client_credentials_request.json",
|
| 245 |
"testdata/data_integrations_vend_credentials_request.json",
|
| 246 |
"testdata/decrypt_request.json",
|
| 247 |
"testdata/decrypt_response.json",
|
|
|
|
| 498 |
"testdata/user_role_assignment_resource.json",
|
| 499 |
"testdata/user_role_assignment_source.json",
|
| 500 |
"testdata/user_sessions_impersonator.json",
|
|
|
|
| 501 |
"testdata/user_updated.json",
|
| 502 |
"testdata/validate_api_key.json",
|
| 503 |
"testdata/vault_byok_key_deleted.json",
|
|
|
|
| 838 |
"sdkMethod": "AuthorizeDataIntegration",
|
| 839 |
"service": "pipes"
|
| 840 |
},
|
| 841 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 842 |
+
"sdkMethod": "UpdateDataIntegrationClientCredentials",
|
| 843 |
+
"service": "pipes"
|
| 844 |
+
},
|
| 845 |
"POST /data-integrations/{slug}/credentials": {
|
| 846 |
"sdkMethod": "CreateDataIntegrationCredential",
|
| 847 |
"service": "pipes"
|
go/enums.go|
@@ -39,13 +39,8 @@ const (
|
|
| 39 |
CustomProviderDefinitionAuthenticateViaBasicAuthHeader CustomProviderDefinitionAuthenticateVia = "basic_auth_header"
|
| 40 |
)
|
| 41 |
|
| 42 |
-
// CreateDataIntegrationAuthMethods
|
| 43 |
-
type CreateDataIntegrationAuthMethods
|
| 44 |
-
|
| 45 |
-
const (
|
| 46 |
-
CreateDataIntegrationAuthMethodsOAuth CreateDataIntegrationAuthMethods = "oauth"
|
| 47 |
-
CreateDataIntegrationAuthMethodsAPIKey CreateDataIntegrationAuthMethods = "api_key"
|
| 48 |
-
)
|
| 49 |
|
| 50 |
// UpdateCustomProviderDefinitionAuthenticateVia is an alias for CustomProviderDefinitionAuthenticateVia.
|
| 51 |
type UpdateCustomProviderDefinitionAuthenticateVia = CustomProviderDefinitionAuthenticateVia
|
|
@@ -195,6 +190,7 @@ const (
|
|
| 195 |
CreateWebhookEndpointEventsAgentRegistrationClaimCompleted CreateWebhookEndpointEvents = "agent.registration.claim.completed"
|
| 196 |
CreateWebhookEndpointEventsAgentRegistrationCredentialIssued CreateWebhookEndpointEvents = "agent.registration.credential.issued"
|
| 197 |
CreateWebhookEndpointEventsAgentRegistrationDeleted CreateWebhookEndpointEvents = "agent.registration.deleted"
|
|
|
|
| 198 |
CreateWebhookEndpointEventsAgentRegistrationExpired CreateWebhookEndpointEvents = "agent.registration.expired"
|
| 199 |
CreateWebhookEndpointEventsAgentRegistrationOrganizationSwitched CreateWebhookEndpointEvents = "agent.registration.organization.switched"
|
| 200 |
CreateWebhookEndpointEventsAgentRegistrationRevoked CreateWebhookEndpointEvents = "agent.registration.revoked"
|
|
@@ -375,6 +371,8 @@ const (
|
|
| 375 |
ConnectionTypeGoogleOAuth ConnectionType = "GoogleOAuth"
|
| 376 |
ConnectionTypeGoogleOIDC ConnectionType = "GoogleOIDC"
|
| 377 |
ConnectionTypeGoogleSAML ConnectionType = "GoogleSAML"
|
|
|
|
|
|
|
| 378 |
ConnectionTypeIntuitOAuth ConnectionType = "IntuitOAuth"
|
| 379 |
ConnectionTypeJumpCloudSAML ConnectionType = "JumpCloudSAML"
|
| 380 |
ConnectionTypeKeycloakSAML ConnectionType = "KeycloakSAML"
|
|
@@ -565,6 +563,8 @@ const (
|
|
| 565 |
ConnectionActivatedDataConnectionTypeGoogleOAuth ConnectionActivatedDataConnectionType = "GoogleOAuth"
|
| 566 |
ConnectionActivatedDataConnectionTypeGoogleOIDC ConnectionActivatedDataConnectionType = "GoogleOIDC"
|
| 567 |
ConnectionActivatedDataConnectionTypeGoogleSAML ConnectionActivatedDataConnectionType = "GoogleSAML"
|
|
|
|
|
|
|
| 568 |
ConnectionActivatedDataConnectionTypeIntuitOAuth ConnectionActivatedDataConnectionType = "IntuitOAuth"
|
| 569 |
ConnectionActivatedDataConnectionTypeJumpCloudSAML ConnectionActivatedDataConnectionType = "JumpCloudSAML"
|
| 570 |
ConnectionActivatedDataConnectionTypeKeycloakSAML ConnectionActivatedDataConnectionType = "KeycloakSAML"
|
|
@@ -977,6 +977,8 @@ const (
|
|
| 977 |
AuthenticateResponseAuthenticationMethodGitHubOAuth AuthenticateResponseAuthenticationMethod = "GitHubOAuth"
|
| 978 |
AuthenticateResponseAuthenticationMethodGitLabOAuth AuthenticateResponseAuthenticationMethod = "GitLabOAuth"
|
| 979 |
AuthenticateResponseAuthenticationMethodGoogleOAuth AuthenticateResponseAuthenticationMethod = "GoogleOAuth"
|
|
|
|
|
|
|
| 980 |
AuthenticateResponseAuthenticationMethodIntuitOAuth AuthenticateResponseAuthenticationMethod = "IntuitOAuth"
|
| 981 |
AuthenticateResponseAuthenticationMethodLinkedInOAuth AuthenticateResponseAuthenticationMethod = "LinkedInOAuth"
|
| 982 |
AuthenticateResponseAuthenticationMethodMicrosoftOAuth AuthenticateResponseAuthenticationMethod = "MicrosoftOAuth"
|
|
@@ -1113,6 +1115,8 @@ const (
|
|
| 1113 |
UserIdentitiesGetItemProviderGithubOAuth UserIdentitiesGetItemProvider = "GithubOAuth"
|
| 1114 |
UserIdentitiesGetItemProviderGitLabOAuth UserIdentitiesGetItemProvider = "GitLabOAuth"
|
| 1115 |
UserIdentitiesGetItemProviderGoogleOAuth UserIdentitiesGetItemProvider = "GoogleOAuth"
|
|
|
|
|
|
|
| 1116 |
UserIdentitiesGetItemProviderIntuitOAuth UserIdentitiesGetItemProvider = "IntuitOAuth"
|
| 1117 |
UserIdentitiesGetItemProviderLinkedInOAuth UserIdentitiesGetItemProvider = "LinkedInOAuth"
|
| 1118 |
UserIdentitiesGetItemProviderMicrosoftOAuth UserIdentitiesGetItemProvider = "MicrosoftOAuth"
|
|
@@ -1176,6 +1180,8 @@ const (
|
|
| 1176 |
ConnectionsConnectionTypeGoogleOAuth ConnectionsConnectionType = "GoogleOAuth"
|
| 1177 |
ConnectionsConnectionTypeGoogleOIDC ConnectionsConnectionType = "GoogleOIDC"
|
| 1178 |
ConnectionsConnectionTypeGoogleSAML ConnectionsConnectionType = "GoogleSAML"
|
|
|
|
|
|
|
| 1179 |
ConnectionsConnectionTypeIntuitOAuth ConnectionsConnectionType = "IntuitOAuth"
|
| 1180 |
ConnectionsConnectionTypeJumpCloudSAML ConnectionsConnectionType = "JumpCloudSAML"
|
| 1181 |
ConnectionsConnectionTypeKeycloakSAML ConnectionsConnectionType = "KeycloakSAML"
|
|
|
|
| 39 |
CustomProviderDefinitionAuthenticateViaBasicAuthHeader CustomProviderDefinitionAuthenticateVia = "basic_auth_header"
|
| 40 |
)
|
| 41 |
|
| 42 |
+
// CreateDataIntegrationAuthMethods is an alias for ConnectedAccountAuthMethod.
|
| 43 |
+
type CreateDataIntegrationAuthMethods = ConnectedAccountAuthMethod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
// UpdateCustomProviderDefinitionAuthenticateVia is an alias for CustomProviderDefinitionAuthenticateVia.
|
| 46 |
type UpdateCustomProviderDefinitionAuthenticateVia = CustomProviderDefinitionAuthenticateVia
|
|
|
|
| 190 |
CreateWebhookEndpointEventsAgentRegistrationClaimCompleted CreateWebhookEndpointEvents = "agent.registration.claim.completed"
|
| 191 |
CreateWebhookEndpointEventsAgentRegistrationCredentialIssued CreateWebhookEndpointEvents = "agent.registration.credential.issued"
|
| 192 |
CreateWebhookEndpointEventsAgentRegistrationDeleted CreateWebhookEndpointEvents = "agent.registration.deleted"
|
| 193 |
+
CreateWebhookEndpointEventsAgentRegistrationRefreshed CreateWebhookEndpointEvents = "agent.registration.refreshed"
|
| 194 |
CreateWebhookEndpointEventsAgentRegistrationExpired CreateWebhookEndpointEvents = "agent.registration.expired"
|
| 195 |
CreateWebhookEndpointEventsAgentRegistrationOrganizationSwitched CreateWebhookEndpointEvents = "agent.registration.organization.switched"
|
| 196 |
CreateWebhookEndpointEventsAgentRegistrationRevoked CreateWebhookEndpointEvents = "agent.registration.revoked"
|
|
|
|
| 371 |
ConnectionTypeGoogleOAuth ConnectionType = "GoogleOAuth"
|
| 372 |
ConnectionTypeGoogleOIDC ConnectionType = "GoogleOIDC"
|
| 373 |
ConnectionTypeGoogleSAML ConnectionType = "GoogleSAML"
|
| 374 |
+
ConnectionTypeGrokOAuth ConnectionType = "GrokOAuth"
|
| 375 |
+
ConnectionTypeXoAuth ConnectionType = "XOAuth"
|
| 376 |
ConnectionTypeIntuitOAuth ConnectionType = "IntuitOAuth"
|
| 377 |
ConnectionTypeJumpCloudSAML ConnectionType = "JumpCloudSAML"
|
| 378 |
ConnectionTypeKeycloakSAML ConnectionType = "KeycloakSAML"
|
|
|
|
| 563 |
ConnectionActivatedDataConnectionTypeGoogleOAuth ConnectionActivatedDataConnectionType = "GoogleOAuth"
|
| 564 |
ConnectionActivatedDataConnectionTypeGoogleOIDC ConnectionActivatedDataConnectionType = "GoogleOIDC"
|
| 565 |
ConnectionActivatedDataConnectionTypeGoogleSAML ConnectionActivatedDataConnectionType = "GoogleSAML"
|
| 566 |
+
ConnectionActivatedDataConnectionTypeGrokOAuth ConnectionActivatedDataConnectionType = "GrokOAuth"
|
| 567 |
+
ConnectionActivatedDataConnectionTypeXoAuth ConnectionActivatedDataConnectionType = "XOAuth"
|
| 568 |
ConnectionActivatedDataConnectionTypeIntuitOAuth ConnectionActivatedDataConnectionType = "IntuitOAuth"
|
| 569 |
ConnectionActivatedDataConnectionTypeJumpCloudSAML ConnectionActivatedDataConnectionType = "JumpCloudSAML"
|
| 570 |
ConnectionActivatedDataConnectionTypeKeycloakSAML ConnectionActivatedDataConnectionType = "KeycloakSAML"
|
|
|
|
| 977 |
AuthenticateResponseAuthenticationMethodGitHubOAuth AuthenticateResponseAuthenticationMethod = "GitHubOAuth"
|
| 978 |
AuthenticateResponseAuthenticationMethodGitLabOAuth AuthenticateResponseAuthenticationMethod = "GitLabOAuth"
|
| 979 |
AuthenticateResponseAuthenticationMethodGoogleOAuth AuthenticateResponseAuthenticationMethod = "GoogleOAuth"
|
| 980 |
+
AuthenticateResponseAuthenticationMethodGrokOAuth AuthenticateResponseAuthenticationMethod = "GrokOAuth"
|
| 981 |
+
AuthenticateResponseAuthenticationMethodXoAuth AuthenticateResponseAuthenticationMethod = "XOAuth"
|
| 982 |
AuthenticateResponseAuthenticationMethodIntuitOAuth AuthenticateResponseAuthenticationMethod = "IntuitOAuth"
|
| 983 |
AuthenticateResponseAuthenticationMethodLinkedInOAuth AuthenticateResponseAuthenticationMethod = "LinkedInOAuth"
|
| 984 |
AuthenticateResponseAuthenticationMethodMicrosoftOAuth AuthenticateResponseAuthenticationMethod = "MicrosoftOAuth"
|
|
|
|
| 1115 |
UserIdentitiesGetItemProviderGithubOAuth UserIdentitiesGetItemProvider = "GithubOAuth"
|
| 1116 |
UserIdentitiesGetItemProviderGitLabOAuth UserIdentitiesGetItemProvider = "GitLabOAuth"
|
| 1117 |
UserIdentitiesGetItemProviderGoogleOAuth UserIdentitiesGetItemProvider = "GoogleOAuth"
|
| 1118 |
+
UserIdentitiesGetItemProviderGrokOAuth UserIdentitiesGetItemProvider = "GrokOAuth"
|
| 1119 |
+
UserIdentitiesGetItemProviderXoAuth UserIdentitiesGetItemProvider = "XOAuth"
|
| 1120 |
UserIdentitiesGetItemProviderIntuitOAuth UserIdentitiesGetItemProvider = "IntuitOAuth"
|
| 1121 |
UserIdentitiesGetItemProviderLinkedInOAuth UserIdentitiesGetItemProvider = "LinkedInOAuth"
|
| 1122 |
UserIdentitiesGetItemProviderMicrosoftOAuth UserIdentitiesGetItemProvider = "MicrosoftOAuth"
|
|
|
|
| 1180 |
ConnectionsConnectionTypeGoogleOAuth ConnectionsConnectionType = "GoogleOAuth"
|
| 1181 |
ConnectionsConnectionTypeGoogleOIDC ConnectionsConnectionType = "GoogleOIDC"
|
| 1182 |
ConnectionsConnectionTypeGoogleSAML ConnectionsConnectionType = "GoogleSAML"
|
| 1183 |
+
ConnectionsConnectionTypeGrokOAuth ConnectionsConnectionType = "GrokOAuth"
|
| 1184 |
+
ConnectionsConnectionTypeXoAuth ConnectionsConnectionType = "XOAuth"
|
| 1185 |
ConnectionsConnectionTypeIntuitOAuth ConnectionsConnectionType = "IntuitOAuth"
|
| 1186 |
ConnectionsConnectionTypeJumpCloudSAML ConnectionsConnectionType = "JumpCloudSAML"
|
| 1187 |
ConnectionsConnectionTypeKeycloakSAML ConnectionsConnectionType = "KeycloakSAML"
|
go/models.go|
@@ -163,10 +163,10 @@ type APIKeyInstallation struct {
|
|
| 163 |
type CustomProviderDefinition struct {
|
| 164 |
// Name is a descriptive name for the custom provider.
|
| 165 |
Name string `json:"name"`
|
| 166 |
-
// AuthorizationURL is the provider's OAuth authorization endpoint.
|
| 167 |
-
AuthorizationURL string `json:"authorization_url"`
|
| 168 |
-
// TokenURL is the provider's OAuth token endpoint.
|
| 169 |
-
TokenURL string `json:"token_url"`
|
| 170 |
// RefreshTokenURL is the endpoint used to refresh tokens, if different from the token endpoint.
|
| 171 |
RefreshTokenURL *string `json:"refresh_token_url,omitempty"`
|
| 172 |
// PKCEEnabled is whether PKCE is used during the authorization code flow. Defaults to `true`.
|
|
@@ -1054,6 +1054,8 @@ type WaitlistUser struct {
|
|
| 1054 |
State WaitlistUserState `json:"state"`
|
| 1055 |
// ApprovedAt is the timestamp when the Waitlist User was approved, or null if not yet approved.
|
| 1056 |
ApprovedAt *string `json:"approved_at"`
|
|
|
|
|
|
|
| 1057 |
// CreatedAt is an ISO 8601 timestamp.
|
| 1058 |
CreatedAt string `json:"created_at"`
|
| 1059 |
// UpdatedAt is an ISO 8601 timestamp.
|
|
@@ -1381,6 +1383,23 @@ type AgentRegistrationOrganizationSwitchedData struct {
|
|
| 1381 |
ToOrganizationID string `json:"to_organization_id"`
|
| 1382 |
}
|
| 1383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1384 |
// AgentRegistrationRevoked represents an agent registration revoked.
|
| 1385 |
type AgentRegistrationRevoked struct {
|
| 1386 |
// Object distinguishes the Event object.
|
|
@@ -4813,7 +4832,7 @@ type DataIntegration struct {
|
|
| 4813 |
RedirectURI string `json:"redirect_uri"`
|
| 4814 |
// AuthMethods is how accounts authenticate with the provider for this Data Integration.
|
| 4815 |
AuthMethods []DataIntegrationAuthMethods `json:"auth_methods"`
|
| 4816 |
-
// Credentials is the credentials
|
| 4817 |
Credentials *DataIntegrationCredential `json:"credentials"`
|
| 4818 |
// Installation is the tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.
|
| 4819 |
Installation *DataIntegrationInstallation `json:"installation"`
|
|
@@ -4880,6 +4899,12 @@ type ConnectedAccount struct {
|
|
| 4880 |
AuthMethod *ConnectedAccountAuthMethod `json:"auth_method,omitempty"`
|
| 4881 |
// APIKeyLast4 is the last four characters of the API key, or `null` for OAuth connections.
|
| 4882 |
APIKeyLast4 *string `json:"api_key_last_4,omitempty"`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4883 |
// State is the state of the connected account:
|
| 4884 |
// - `connected`: The connection is active and tokens are valid.
|
| 4885 |
// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
|
@@ -5458,7 +5483,7 @@ type DataIntegrationAccessTokenResponseAccessToken struct {
|
|
| 5458 |
MissingScopes []string `json:"missing_scopes"`
|
| 5459 |
}
|
| 5460 |
|
| 5461 |
-
// DataIntegrationCredential
|
| 5462 |
type DataIntegrationCredential struct {
|
| 5463 |
// Type is the credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself).
|
| 5464 |
Type DataIntegrationCredentialType `json:"type"`
|
|
@@ -5973,10 +5998,10 @@ type RadarSmsChallengeCodeSessionAuthenticateRequest struct {
|
|
| 5973 |
GrantType string `json:"grant_type"`
|
| 5974 |
// Code is the one-time code from the Radar SMS challenge.
|
| 5975 |
Code string `json:"code"`
|
| 5976 |
-
// VerificationID is the ID of the Radar SMS verification being confirmed.
|
| 5977 |
-
VerificationID string `json:"verification_id"`
|
| 5978 |
-
// PhoneNumber is the phone number the Radar SMS challenge was sent to.
|
| 5979 |
-
PhoneNumber string `json:"phone_number"`
|
| 5980 |
// PendingAuthenticationToken is the pending authentication token from a previous authentication attempt.
|
| 5981 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 5982 |
// IPAddress is the IP address of the user's request.
|
|
@@ -6243,6 +6268,12 @@ type DataIntegrationsListResponseDataConnectedAccount struct {
|
|
| 6243 |
AuthMethod *DataIntegrationsListResponseDataConnectedAccountAuthMethod `json:"auth_method,omitempty"`
|
| 6244 |
// APIKeyLast4 is the last four characters of the API key, or `null` for OAuth connections.
|
| 6245 |
APIKeyLast4 *string `json:"api_key_last_4,omitempty"`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6246 |
// State is the state of the connected account:
|
| 6247 |
// - `connected`: The connection is active and tokens are valid.
|
| 6248 |
// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
|
|
|
| 163 |
type CustomProviderDefinition struct {
|
| 164 |
// Name is a descriptive name for the custom provider.
|
| 165 |
Name string `json:"name"`
|
| 166 |
+
// AuthorizationURL is the provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers.
|
| 167 |
+
AuthorizationURL *string `json:"authorization_url,omitempty"`
|
| 168 |
+
// TokenURL is the provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers.
|
| 169 |
+
TokenURL *string `json:"token_url,omitempty"`
|
| 170 |
// RefreshTokenURL is the endpoint used to refresh tokens, if different from the token endpoint.
|
| 171 |
RefreshTokenURL *string `json:"refresh_token_url,omitempty"`
|
| 172 |
// PKCEEnabled is whether PKCE is used during the authorization code flow. Defaults to `true`.
|
|
|
|
| 1054 |
State WaitlistUserState `json:"state"`
|
| 1055 |
// ApprovedAt is the timestamp when the Waitlist User was approved, or null if not yet approved.
|
| 1056 |
ApprovedAt *string `json:"approved_at"`
|
| 1057 |
+
// WaitlistID is the unique ID of the Waitlist that the Waitlist User joined.
|
| 1058 |
+
WaitlistID *string `json:"waitlist_id,omitempty"`
|
| 1059 |
// CreatedAt is an ISO 8601 timestamp.
|
| 1060 |
CreatedAt string `json:"created_at"`
|
| 1061 |
// UpdatedAt is an ISO 8601 timestamp.
|
|
|
|
| 1383 |
ToOrganizationID string `json:"to_organization_id"`
|
| 1384 |
}
|
| 1385 |
|
| 1386 |
+
// AgentRegistrationRefreshed represents an agent registration refreshed.
|
| 1387 |
+
type AgentRegistrationRefreshed struct {
|
| 1388 |
+
// Object distinguishes the Event object.
|
| 1389 |
+
Object string `json:"object"`
|
| 1390 |
+
// ID is unique identifier for the event.
|
| 1391 |
+
ID string `json:"id"`
|
| 1392 |
+
Event string `json:"event"`
|
| 1393 |
+
// Data is the event payload.
|
| 1394 |
+
Data *AgentRegistrationRefreshedData `json:"data"`
|
| 1395 |
+
// CreatedAt is an ISO 8601 timestamp.
|
| 1396 |
+
CreatedAt string `json:"created_at"`
|
| 1397 |
+
Context *EventContext `json:"context,omitempty"`
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
// AgentRegistrationRefreshedData is an alias for AgentRegistrationDeletedData.
|
| 1401 |
+
type AgentRegistrationRefreshedData = AgentRegistrationDeletedData
|
| 1402 |
+
|
| 1403 |
// AgentRegistrationRevoked represents an agent registration revoked.
|
| 1404 |
type AgentRegistrationRevoked struct {
|
| 1405 |
// Object distinguishes the Event object.
|
|
|
|
| 4832 |
RedirectURI string `json:"redirect_uri"`
|
| 4833 |
// AuthMethods is how accounts authenticate with the provider for this Data Integration.
|
| 4834 |
AuthMethods []DataIntegrationAuthMethods `json:"auth_methods"`
|
| 4835 |
+
// Credentials is the integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant).
|
| 4836 |
Credentials *DataIntegrationCredential `json:"credentials"`
|
| 4837 |
// Installation is the tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.
|
| 4838 |
Installation *DataIntegrationInstallation `json:"installation"`
|
|
|
|
| 4899 |
AuthMethod *ConnectedAccountAuthMethod `json:"auth_method,omitempty"`
|
| 4900 |
// APIKeyLast4 is the last four characters of the API key, or `null` for OAuth connections.
|
| 4901 |
APIKeyLast4 *string `json:"api_key_last_4,omitempty"`
|
| 4902 |
+
// ClientID is the client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.
|
| 4903 |
+
ClientID *string `json:"client_id,omitempty"`
|
| 4904 |
+
// ClientSecretLast4 is the last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.
|
| 4905 |
+
ClientSecretLast4 *string `json:"client_secret_last_4,omitempty"`
|
| 4906 |
+
// Config is the connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 4907 |
+
Config map[string]string `json:"config,omitempty"`
|
| 4908 |
// State is the state of the connected account:
|
| 4909 |
// - `connected`: The connection is active and tokens are valid.
|
| 4910 |
// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
|
|
|
| 5483 |
MissingScopes []string `json:"missing_scopes"`
|
| 5484 |
}
|
| 5485 |
|
| 5486 |
+
// DataIntegrationCredential represents a data integration credential.
|
| 5487 |
type DataIntegrationCredential struct {
|
| 5488 |
// Type is the credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself).
|
| 5489 |
Type DataIntegrationCredentialType `json:"type"`
|
|
|
|
| 5998 |
GrantType string `json:"grant_type"`
|
| 5999 |
// Code is the one-time code from the Radar SMS challenge.
|
| 6000 |
Code string `json:"code"`
|
| 6001 |
+
// VerificationID is the ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
| 6002 |
+
VerificationID *string `json:"verification_id,omitempty"`
|
| 6003 |
+
// PhoneNumber is the phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
| 6004 |
+
PhoneNumber *string `json:"phone_number,omitempty"`
|
| 6005 |
// PendingAuthenticationToken is the pending authentication token from a previous authentication attempt.
|
| 6006 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 6007 |
// IPAddress is the IP address of the user's request.
|
|
|
|
| 6268 |
AuthMethod *DataIntegrationsListResponseDataConnectedAccountAuthMethod `json:"auth_method,omitempty"`
|
| 6269 |
// APIKeyLast4 is the last four characters of the API key, or `null` for OAuth connections.
|
| 6270 |
APIKeyLast4 *string `json:"api_key_last_4,omitempty"`
|
| 6271 |
+
// ClientID is the client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.
|
| 6272 |
+
ClientID *string `json:"client_id,omitempty"`
|
| 6273 |
+
// ClientSecretLast4 is the last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.
|
| 6274 |
+
ClientSecretLast4 *string `json:"client_secret_last_4,omitempty"`
|
| 6275 |
+
// Config is the connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 6276 |
+
Config map[string]string `json:"config,omitempty"`
|
| 6277 |
// State is the state of the connected account:
|
| 6278 |
// - `connected`: The connection is active and tokens are valid.
|
| 6279 |
// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
go/pipes.go|
@@ -35,7 +35,7 @@ type PipesCreateDataIntegrationParams struct {
|
|
| 35 |
Enabled *bool `json:"enabled,omitempty" url:"-"`
|
| 36 |
// Scopes is the OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 37 |
Scopes []string `json:"scopes,omitempty" url:"-"`
|
| 38 |
-
// AuthMethods is how accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 39 |
AuthMethods []CreateDataIntegrationAuthMethods `json:"auth_methods,omitempty" url:"-"`
|
| 40 |
// Config is provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 41 |
Config map[string]string `json:"config,omitempty" url:"-"`
|
|
@@ -78,7 +78,7 @@ func (p PipesCreateDataIntegrationParams) MarshalJSON() ([]byte, error) {
|
|
| 78 |
}
|
| 79 |
|
| 80 |
// CreateDataIntegration create a data integration
|
| 81 |
-
// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 82 |
func (s *PipeService) CreateDataIntegration(ctx context.Context, params *PipesCreateDataIntegrationParams, opts ...RequestOption) (*DataIntegration, error) {
|
| 83 |
var result DataIntegration
|
| 84 |
_, err := s.client.request(ctx, "POST", "/data-integrations", nil, params, &result, opts)
|
|
@@ -207,6 +207,31 @@ func (s *PipeService) AuthorizeDataIntegration(ctx context.Context, slug string,
|
|
| 207 |
return &result, nil
|
| 208 |
}
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
// PipesCreateDataIntegrationCredentialParams contains the parameters for CreateDataIntegrationCredential.
|
| 211 |
type PipesCreateDataIntegrationCredentialParams struct {
|
| 212 |
// UserID is a [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
|
|
| 35 |
Enabled *bool `json:"enabled,omitempty" url:"-"`
|
| 36 |
// Scopes is the OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 37 |
Scopes []string `json:"scopes,omitempty" url:"-"`
|
| 38 |
+
// AuthMethods is how accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 39 |
AuthMethods []CreateDataIntegrationAuthMethods `json:"auth_methods,omitempty" url:"-"`
|
| 40 |
// Config is provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 41 |
Config map[string]string `json:"config,omitempty" url:"-"`
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
// CreateDataIntegration create a data integration
|
| 81 |
+
// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 82 |
func (s *PipeService) CreateDataIntegration(ctx context.Context, params *PipesCreateDataIntegrationParams, opts ...RequestOption) (*DataIntegration, error) {
|
| 83 |
var result DataIntegration
|
| 84 |
_, err := s.client.request(ctx, "POST", "/data-integrations", nil, params, &result, opts)
|
|
|
|
| 207 |
return &result, nil
|
| 208 |
}
|
| 209 |
|
| 210 |
+
// PipesUpdateDataIntegrationClientCredentialsParams contains the parameters for UpdateDataIntegrationClientCredentials.
|
| 211 |
+
type PipesUpdateDataIntegrationClientCredentialsParams struct {
|
| 212 |
+
// UserID is a [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 213 |
+
UserID string `json:"user_id" url:"-"`
|
| 214 |
+
// OrganizationID is an [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 215 |
+
OrganizationID *string `json:"organization_id,omitempty" url:"-"`
|
| 216 |
+
// ClientID is the OAuth client ID to store for this integration.
|
| 217 |
+
ClientID string `json:"client_id" url:"-"`
|
| 218 |
+
// ClientSecret is the OAuth client secret to store for this integration.
|
| 219 |
+
ClientSecret string `json:"client_secret" url:"-"`
|
| 220 |
+
// Config is provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 221 |
+
Config map[string]string `json:"config,omitempty" url:"-"`
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
// UpdateDataIntegrationClientCredentials upsert client credentials for a connected account
|
| 225 |
+
// Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 226 |
+
func (s *PipeService) UpdateDataIntegrationClientCredentials(ctx context.Context, slug string, params *PipesUpdateDataIntegrationClientCredentialsParams, opts ...RequestOption) (*ConnectedAccount, error) {
|
| 227 |
+
var result ConnectedAccount
|
| 228 |
+
_, err := s.client.request(ctx, "PUT", fmt.Sprintf("/data-integrations/%s/client-credentials", url.PathEscape(slug)), nil, params, &result, opts)
|
| 229 |
+
if err != nil {
|
| 230 |
+
return nil, err
|
| 231 |
+
}
|
| 232 |
+
return &result, nil
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
// PipesCreateDataIntegrationCredentialParams contains the parameters for CreateDataIntegrationCredential.
|
| 236 |
type PipesCreateDataIntegrationCredentialParams struct {
|
| 237 |
// UserID is a [User](https://workos.com/docs/reference/authkit/user) identifier.
|
go/pipes_test.go|
@@ -191,6 +191,32 @@ func TestPipes_AuthorizeDataIntegration(t *testing.T) {
|
|
| 191 |
require.Equal(t, "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect", result.URL)
|
| 192 |
}
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
func TestPipes_CreateDataIntegrationCredential(t *testing.T) {
|
| 195 |
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| 196 |
require.Equal(t, "POST", r.Method)
|
|
|
|
| 191 |
require.Equal(t, "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect", result.URL)
|
| 192 |
}
|
| 193 |
|
| 194 |
+
func TestPipes_UpdateDataIntegrationClientCredentials(t *testing.T) {
|
| 195 |
+
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| 196 |
+
require.Equal(t, "PUT", r.Method)
|
| 197 |
+
require.Equal(t, "/data-integrations/test_slug/client-credentials", r.URL.Path)
|
| 198 |
+
body, _ := io.ReadAll(r.Body)
|
| 199 |
+
var bodyMap map[string]interface{}
|
| 200 |
+
require.NoError(t, json.Unmarshal(body, &bodyMap))
|
| 201 |
+
w.Header().Set("Content-Type", "application/json")
|
| 202 |
+
w.WriteHeader(http.StatusOK)
|
| 203 |
+
fixture, err := os.ReadFile("testdata/connected_account.json")
|
| 204 |
+
if err != nil {
|
| 205 |
+
t.Fatalf("failed to read fixture: %v", err)
|
| 206 |
+
}
|
| 207 |
+
w.Write(fixture)
|
| 208 |
+
}))
|
| 209 |
+
defer server.Close()
|
| 210 |
+
|
| 211 |
+
client := workos.NewClient("sk_test", workos.WithBaseURL(server.URL))
|
| 212 |
+
result, err := client.Pipes().UpdateDataIntegrationClientCredentials(context.Background(), "test_slug", &workos.PipesUpdateDataIntegrationClientCredentialsParams{})
|
| 213 |
+
require.NoError(t, err)
|
| 214 |
+
require.NotNil(t, result)
|
| 215 |
+
require.Equal(t, "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", result.ID)
|
| 216 |
+
require.Equal(t, "2024-01-16T14:20:00.000Z", result.CreatedAt)
|
| 217 |
+
require.Equal(t, "2024-01-16T14:20:00.000Z", result.UpdatedAt)
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
func TestPipes_CreateDataIntegrationCredential(t *testing.T) {
|
| 221 |
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
| 222 |
require.Equal(t, "POST", r.Method)
|
go/pkg/events/events.go|
@@ -11,6 +11,7 @@ const (
|
|
| 11 |
AgentRegistrationClaimCompleted = "agent.registration.claim.completed"
|
| 12 |
AgentRegistrationCredentialIssued = "agent.registration.credential.issued"
|
| 13 |
AgentRegistrationDeleted = "agent.registration.deleted"
|
|
|
|
| 14 |
AgentRegistrationExpired = "agent.registration.expired"
|
| 15 |
AgentRegistrationOrganizationSwitched = "agent.registration.organization.switched"
|
| 16 |
AgentRegistrationRevoked = "agent.registration.revoked"
|
|
|
|
| 11 |
AgentRegistrationClaimCompleted = "agent.registration.claim.completed"
|
| 12 |
AgentRegistrationCredentialIssued = "agent.registration.credential.issued"
|
| 13 |
AgentRegistrationDeleted = "agent.registration.deleted"
|
| 14 |
+
AgentRegistrationRefreshed = "agent.registration.refreshed"
|
| 15 |
AgentRegistrationExpired = "agent.registration.expired"
|
| 16 |
AgentRegistrationOrganizationSwitched = "agent.registration.organization.switched"
|
| 17 |
AgentRegistrationRevoked = "agent.registration.revoked"
|
go/testdata/agent_registration_refreshed.json|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
+
"context": {
|
| 10 |
+
"google_analytics_client_id": "GA1.2.1234567890.1234567890",
|
| 11 |
+
"google_analytics_sessions": [
|
| 12 |
+
{
|
| 13 |
+
"containerId": "GTM-ABCDEF",
|
| 14 |
+
"sessionId": "1234567890",
|
| 15 |
+
"sessionNumber": "1"
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 19 |
+
"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 20 |
+
"actor": {
|
| 21 |
+
"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 22 |
+
"source": "api",
|
| 23 |
+
"name": "Jane Doe"
|
| 24 |
+
},
|
| 25 |
+
"previous_attributes": {
|
| 26 |
+
"key": {}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
go/testdata/connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
go/testdata/data_integrations_list_response.json|
@@ -30,6 +30,11 @@
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
"state": "connected",
|
| 34 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 35 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
| 33 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 34 |
+
"client_secret_last_4": "cdef",
|
| 35 |
+
"config": {
|
| 36 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 37 |
+
},
|
| 38 |
"state": "connected",
|
| 39 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 40 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
go/testdata/data_integrations_list_response_data.json|
@@ -27,6 +27,11 @@
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"state": "connected",
|
| 31 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 32 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
| 30 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 31 |
+
"client_secret_last_4": "cdef",
|
| 32 |
+
"config": {
|
| 33 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 34 |
+
},
|
| 35 |
"state": "connected",
|
| 36 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 37 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
go/testdata/data_integrations_list_response_data_connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
go/testdata/data_integrations_upsert_client_credentials_request.json|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"client_id": "3MVG9...",
|
| 5 |
+
"client_secret": "shhh-secret",
|
| 6 |
+
"config": {
|
| 7 |
+
"mydomain": "acme"
|
| 8 |
+
}
|
| 9 |
+
}
|
go/testdata/waitlist_user.json|
@@ -4,6 +4,7 @@
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
|
|
|
| 7 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 8 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
}
|
|
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
| 7 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 8 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 10 |
}
|
go/testdata/waitlist_user_approved.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
go/testdata/waitlist_user_created.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
go/testdata/waitlist_user_denied.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
go/user_management.go|
@@ -496,10 +496,10 @@ func (s *UserManagementService) AuthenticateWithRadarEmailChallenge(ctx context.
|
|
| 496 |
type UserManagementAuthenticateWithRadarSmsChallengeParams struct {
|
| 497 |
// Code is the one-time code from the Radar SMS challenge.
|
| 498 |
Code string `json:"code"`
|
| 499 |
-
// VerificationID is the ID of the Radar SMS verification being confirmed.
|
| 500 |
-
VerificationID string `json:"verification_id"`
|
| 501 |
-
// PhoneNumber is the phone number the Radar SMS challenge was sent to.
|
| 502 |
-
PhoneNumber string `json:"phone_number"`
|
| 503 |
// PendingAuthenticationToken is the pending authentication token from a previous authentication attempt.
|
| 504 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 505 |
// IPAddress is the IP address of the user's request.
|
|
@@ -514,11 +514,11 @@ type UserManagementAuthenticateWithRadarSmsChallengeParams struct {
|
|
| 514 |
type authenticateWithRadarSmsChallengeBody struct {
|
| 515 |
GrantType string `json:"grant_type"`
|
| 516 |
Code string `json:"code"`
|
| 517 |
-
VerificationID string `json:"verification_id"`
|
| 518 |
-
PhoneNumber string `json:"phone_number"`
|
| 519 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 520 |
ClientID string `json:"client_id,omitempty"`
|
| 521 |
ClientSecret string `json:"client_secret,omitempty"`
|
|
|
|
|
|
|
| 522 |
IPAddress *string `json:"ip_address,omitempty"`
|
| 523 |
DeviceID *string `json:"device_id,omitempty"`
|
| 524 |
UserAgent *string `json:"user_agent,omitempty"`
|
|
@@ -529,12 +529,12 @@ func (s *UserManagementService) AuthenticateWithRadarSmsChallenge(ctx context.Co
|
|
| 529 |
body := authenticateWithRadarSmsChallengeBody{
|
| 530 |
GrantType: "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 531 |
Code: params.Code,
|
| 532 |
-
VerificationID: params.VerificationID,
|
| 533 |
-
PhoneNumber: params.PhoneNumber,
|
| 534 |
PendingAuthenticationToken: params.PendingAuthenticationToken,
|
| 535 |
}
|
| 536 |
body.ClientID = s.client.clientID
|
| 537 |
body.ClientSecret = s.client.apiKey
|
|
|
|
|
|
|
| 538 |
body.IPAddress = params.IPAddress
|
| 539 |
body.DeviceID = params.DeviceID
|
| 540 |
body.UserAgent = params.UserAgent
|
|
|
|
| 496 |
type UserManagementAuthenticateWithRadarSmsChallengeParams struct {
|
| 497 |
// Code is the one-time code from the Radar SMS challenge.
|
| 498 |
Code string `json:"code"`
|
| 499 |
+
// VerificationID is the ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
| 500 |
+
VerificationID *string `json:"verification_id,omitempty"`
|
| 501 |
+
// PhoneNumber is the phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
| 502 |
+
PhoneNumber *string `json:"phone_number,omitempty"`
|
| 503 |
// PendingAuthenticationToken is the pending authentication token from a previous authentication attempt.
|
| 504 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 505 |
// IPAddress is the IP address of the user's request.
|
|
|
|
| 514 |
type authenticateWithRadarSmsChallengeBody struct {
|
| 515 |
GrantType string `json:"grant_type"`
|
| 516 |
Code string `json:"code"`
|
|
|
|
|
|
|
| 517 |
PendingAuthenticationToken string `json:"pending_authentication_token"`
|
| 518 |
ClientID string `json:"client_id,omitempty"`
|
| 519 |
ClientSecret string `json:"client_secret,omitempty"`
|
| 520 |
+
VerificationID *string `json:"verification_id,omitempty"`
|
| 521 |
+
PhoneNumber *string `json:"phone_number,omitempty"`
|
| 522 |
IPAddress *string `json:"ip_address,omitempty"`
|
| 523 |
DeviceID *string `json:"device_id,omitempty"`
|
| 524 |
UserAgent *string `json:"user_agent,omitempty"`
|
|
|
|
| 529 |
body := authenticateWithRadarSmsChallengeBody{
|
| 530 |
GrantType: "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 531 |
Code: params.Code,
|
|
|
|
|
|
|
| 532 |
PendingAuthenticationToken: params.PendingAuthenticationToken,
|
| 533 |
}
|
| 534 |
body.ClientID = s.client.clientID
|
| 535 |
body.ClientSecret = s.client.apiKey
|
| 536 |
+
body.VerificationID = params.VerificationID
|
| 537 |
+
body.PhoneNumber = params.PhoneNumber
|
| 538 |
body.IPAddress = params.IPAddress
|
| 539 |
body.DeviceID = params.DeviceID
|
| 540 |
body.UserAgent = params.UserAgent
|
All files in this language are hidden by the current filters.
code: 0 ยท tests: 0 ยท manifest: 0
No changes for this language.
All files in this language are hidden by the current filters.
code: 21 ยท tests: 17 ยท manifest: 1
kotlin/.oagen-manifest.json|
@@ -46,6 +46,8 @@
|
|
| 46 |
"src/main/kotlin/com/workos/models/AgentRegistrationExpiredData.kt",
|
| 47 |
"src/main/kotlin/com/workos/models/AgentRegistrationOrganizationSwitched.kt",
|
| 48 |
"src/main/kotlin/com/workos/models/AgentRegistrationOrganizationSwitchedData.kt",
|
|
|
|
|
|
|
| 49 |
"src/main/kotlin/com/workos/models/AgentRegistrationRevoked.kt",
|
| 50 |
"src/main/kotlin/com/workos/models/AgentRegistrationRevokedData.kt",
|
| 51 |
"src/main/kotlin/com/workos/models/ApiKey.kt",
|
|
@@ -229,6 +231,7 @@
|
|
| 229 |
"src/main/kotlin/com/workos/models/DataIntegrationsListResponseData.kt",
|
| 230 |
"src/main/kotlin/com/workos/models/DataIntegrationsListResponseDataConnectedAccount.kt",
|
| 231 |
"src/main/kotlin/com/workos/models/DataIntegrationsUpsertApiKeyRequest.kt",
|
|
|
|
| 232 |
"src/main/kotlin/com/workos/models/DataIntegrationsVendCredentialsRequest.kt",
|
| 233 |
"src/main/kotlin/com/workos/models/DecryptRequest.kt",
|
| 234 |
"src/main/kotlin/com/workos/models/DecryptResponse.kt",
|
|
@@ -1024,6 +1027,10 @@
|
|
| 1024 |
"sdkMethod": "authorizeDataIntegration",
|
| 1025 |
"service": "pipes"
|
| 1026 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1027 |
"POST /data-integrations/{slug}/credentials": {
|
| 1028 |
"sdkMethod": "createDataIntegrationCredential",
|
| 1029 |
"service": "pipes"
|
|
|
|
| 46 |
"src/main/kotlin/com/workos/models/AgentRegistrationExpiredData.kt",
|
| 47 |
"src/main/kotlin/com/workos/models/AgentRegistrationOrganizationSwitched.kt",
|
| 48 |
"src/main/kotlin/com/workos/models/AgentRegistrationOrganizationSwitchedData.kt",
|
| 49 |
+
"src/main/kotlin/com/workos/models/AgentRegistrationRefreshed.kt",
|
| 50 |
+
"src/main/kotlin/com/workos/models/AgentRegistrationRefreshedData.kt",
|
| 51 |
"src/main/kotlin/com/workos/models/AgentRegistrationRevoked.kt",
|
| 52 |
"src/main/kotlin/com/workos/models/AgentRegistrationRevokedData.kt",
|
| 53 |
"src/main/kotlin/com/workos/models/ApiKey.kt",
|
|
|
|
| 231 |
"src/main/kotlin/com/workos/models/DataIntegrationsListResponseData.kt",
|
| 232 |
"src/main/kotlin/com/workos/models/DataIntegrationsListResponseDataConnectedAccount.kt",
|
| 233 |
"src/main/kotlin/com/workos/models/DataIntegrationsUpsertApiKeyRequest.kt",
|
| 234 |
+
"src/main/kotlin/com/workos/models/DataIntegrationsUpsertClientCredentialsRequest.kt",
|
| 235 |
"src/main/kotlin/com/workos/models/DataIntegrationsVendCredentialsRequest.kt",
|
| 236 |
"src/main/kotlin/com/workos/models/DecryptRequest.kt",
|
| 237 |
"src/main/kotlin/com/workos/models/DecryptResponse.kt",
|
|
|
|
| 1027 |
"sdkMethod": "authorizeDataIntegration",
|
| 1028 |
"service": "pipes"
|
| 1029 |
},
|
| 1030 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1031 |
+
"sdkMethod": "updateDataIntegrationClientCredentials",
|
| 1032 |
+
"service": "pipes"
|
| 1033 |
+
},
|
| 1034 |
"POST /data-integrations/{slug}/credentials": {
|
| 1035 |
"sdkMethod": "createDataIntegrationCredential",
|
| 1036 |
"service": "pipes"
|
kotlin/src/main/kotlin/com/workos/models/AgentRegistrationRefreshed.kt|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
package com.workos.models
|
| 4 |
+
|
| 5 |
+
import com.fasterxml.jackson.annotation.JsonProperty
|
| 6 |
+
import java.time.OffsetDateTime
|
| 7 |
+
|
| 8 |
+
/** AgentRegistrationRefreshed model. */
|
| 9 |
+
data class AgentRegistrationRefreshed(
|
| 10 |
+
/** Unique identifier for the event. */
|
| 11 |
+
@JsonProperty("id")
|
| 12 |
+
override val id: String,
|
| 13 |
+
|
| 14 |
+
/** The event payload. */
|
| 15 |
+
@JsonProperty("data")
|
| 16 |
+
val data: AgentRegistrationRefreshedData,
|
| 17 |
+
|
| 18 |
+
/** An ISO 8601 timestamp. */
|
| 19 |
+
@JsonProperty("created_at")
|
| 20 |
+
override val createdAt: OffsetDateTime,
|
| 21 |
+
|
| 22 |
+
/** Distinguishes the Event object. */
|
| 23 |
+
@JsonProperty("object")
|
| 24 |
+
val objectType: String = "event",
|
| 25 |
+
|
| 26 |
+
/** Always `"agent.registration.refreshed"`. */
|
| 27 |
+
@JsonProperty("event")
|
| 28 |
+
override val event: String = "agent.registration.refreshed",
|
| 29 |
+
|
| 30 |
+
/** The context. */
|
| 31 |
+
@JsonProperty("context")
|
| 32 |
+
val context: EventContext? = null
|
| 33 |
+
) : WorkOSEvent
|
kotlin/src/main/kotlin/com/workos/models/AgentRegistrationRefreshedData.kt|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
package com.workos.models
|
| 4 |
+
|
| 5 |
+
/** Alias for [AgentRegistrationDeletedData]. */
|
| 6 |
+
typealias AgentRegistrationRefreshedData = AgentRegistrationDeletedData
|
kotlin/src/main/kotlin/com/workos/models/ConnectedAccount.kt|
@@ -46,5 +46,17 @@ data class ConnectedAccount(
|
|
| 46 |
|
| 47 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 48 |
@JsonProperty("api_key_last_4")
|
| 49 |
-
val apiKeyLast4: String? = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
)
|
|
|
|
| 46 |
|
| 47 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 48 |
@JsonProperty("api_key_last_4")
|
| 49 |
+
val apiKeyLast4: String? = null,
|
| 50 |
+
|
| 51 |
+
/** The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`. */
|
| 52 |
+
@JsonProperty("client_id")
|
| 53 |
+
val clientId: String? = null,
|
| 54 |
+
|
| 55 |
+
/** The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`. */
|
| 56 |
+
@JsonProperty("client_secret_last_4")
|
| 57 |
+
val clientSecretLast4: String? = null,
|
| 58 |
+
|
| 59 |
+
/** The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`. */
|
| 60 |
+
@JsonProperty("config")
|
| 61 |
+
val config: Map<String, String>? = null
|
| 62 |
)
|
kotlin/src/main/kotlin/com/workos/models/CreateDataIntegration.kt|
@@ -23,7 +23,7 @@ data class CreateDataIntegration(
|
|
| 23 |
@JsonProperty("scopes")
|
| 24 |
val scopes: List<String>? = null,
|
| 25 |
|
| 26 |
-
/** How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). */
|
| 27 |
@JsonProperty("auth_methods")
|
| 28 |
val authMethods: List<CreateDataIntegrationAuthMethods>? = null,
|
| 29 |
|
|
|
|
| 23 |
@JsonProperty("scopes")
|
| 24 |
val scopes: List<String>? = null,
|
| 25 |
|
| 26 |
+
/** How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant. */
|
| 27 |
@JsonProperty("auth_methods")
|
| 28 |
val authMethods: List<CreateDataIntegrationAuthMethods>? = null,
|
| 29 |
|
kotlin/src/main/kotlin/com/workos/models/CustomProviderDefinition.kt|
@@ -11,13 +11,13 @@ data class CustomProviderDefinition(
|
|
| 11 |
@JsonProperty("name")
|
| 12 |
val name: String,
|
| 13 |
|
| 14 |
-
/** The provider's OAuth authorization endpoint. */
|
| 15 |
@JsonProperty("authorization_url")
|
| 16 |
-
val authorizationUrl: String,
|
| 17 |
|
| 18 |
-
/** The provider's OAuth token endpoint. */
|
| 19 |
@JsonProperty("token_url")
|
| 20 |
-
val tokenUrl: String,
|
| 21 |
|
| 22 |
/** The endpoint used to refresh tokens, if different from the token endpoint. */
|
| 23 |
@JsonProperty("refresh_token_url")
|
|
|
|
| 11 |
@JsonProperty("name")
|
| 12 |
val name: String,
|
| 13 |
|
| 14 |
+
/** The provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers. */
|
| 15 |
@JsonProperty("authorization_url")
|
| 16 |
+
val authorizationUrl: String? = null,
|
| 17 |
|
| 18 |
+
/** The provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers. */
|
| 19 |
@JsonProperty("token_url")
|
| 20 |
+
val tokenUrl: String? = null,
|
| 21 |
|
| 22 |
/** The endpoint used to refresh tokens, if different from the token endpoint. */
|
| 23 |
@JsonProperty("refresh_token_url")
|
kotlin/src/main/kotlin/com/workos/models/DataIntegration.kt|
@@ -45,9 +45,9 @@ data class DataIntegration(
|
|
| 45 |
@JsonProperty("auth_methods")
|
| 46 |
val authMethods: List<DataIntegrationAuthMethods>,
|
| 47 |
|
| 48 |
-
/** The credentials
|
| 49 |
@JsonProperty("credentials")
|
| 50 |
-
val credentials: DataIntegrationCredential,
|
| 51 |
|
| 52 |
/** The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses. */
|
| 53 |
@JsonProperty("installation")
|
|
|
|
| 45 |
@JsonProperty("auth_methods")
|
| 46 |
val authMethods: List<DataIntegrationAuthMethods>,
|
| 47 |
|
| 48 |
+
/** The integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant). */
|
| 49 |
@JsonProperty("credentials")
|
| 50 |
+
val credentials: DataIntegrationCredential?,
|
| 51 |
|
| 52 |
/** The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses. */
|
| 53 |
@JsonProperty("installation")
|
kotlin/src/main/kotlin/com/workos/models/DataIntegrationCredential.kt|
@@ -5,7 +5,7 @@ package com.workos.models
|
|
| 5 |
import com.fasterxml.jackson.annotation.JsonProperty
|
| 6 |
import com.workos.types.DataIntegrationCredentialType
|
| 7 |
|
| 8 |
-
/**
|
| 9 |
data class DataIntegrationCredential(
|
| 10 |
/** The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself). */
|
| 11 |
@JsonProperty("type")
|
|
|
|
| 5 |
import com.fasterxml.jackson.annotation.JsonProperty
|
| 6 |
import com.workos.types.DataIntegrationCredentialType
|
| 7 |
|
| 8 |
+
/** DataIntegrationCredential model. */
|
| 9 |
data class DataIntegrationCredential(
|
| 10 |
/** The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself). */
|
| 11 |
@JsonProperty("type")
|
kotlin/src/main/kotlin/com/workos/models/DataIntegrationsListResponseDataConnectedAccount.kt|
@@ -51,5 +51,17 @@ data class DataIntegrationsListResponseDataConnectedAccount(
|
|
| 51 |
|
| 52 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 53 |
@JsonProperty("api_key_last_4")
|
| 54 |
-
val apiKeyLast4: String? = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
)
|
|
|
|
| 51 |
|
| 52 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 53 |
@JsonProperty("api_key_last_4")
|
| 54 |
+
val apiKeyLast4: String? = null,
|
| 55 |
+
|
| 56 |
+
/** The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`. */
|
| 57 |
+
@JsonProperty("client_id")
|
| 58 |
+
val clientId: String? = null,
|
| 59 |
+
|
| 60 |
+
/** The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`. */
|
| 61 |
+
@JsonProperty("client_secret_last_4")
|
| 62 |
+
val clientSecretLast4: String? = null,
|
| 63 |
+
|
| 64 |
+
/** The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`. */
|
| 65 |
+
@JsonProperty("config")
|
| 66 |
+
val config: Map<String, String>? = null
|
| 67 |
)
|
kotlin/src/main/kotlin/com/workos/models/DataIntegrationsUpsertClientCredentialsRequest.kt|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
package com.workos.models
|
| 4 |
+
|
| 5 |
+
import com.fasterxml.jackson.annotation.JsonProperty
|
| 6 |
+
|
| 7 |
+
/** DataIntegrationsUpsertClientCredentialsRequest model. */
|
| 8 |
+
data class DataIntegrationsUpsertClientCredentialsRequest(
|
| 9 |
+
/** A [User](https://workos.com/docs/reference/authkit/user) identifier. */
|
| 10 |
+
@JsonProperty("user_id")
|
| 11 |
+
val userId: String,
|
| 12 |
+
|
| 13 |
+
/** The OAuth client ID to store for this integration. */
|
| 14 |
+
@JsonProperty("client_id")
|
| 15 |
+
val clientId: String,
|
| 16 |
+
|
| 17 |
+
/** The OAuth client secret to store for this integration. */
|
| 18 |
+
@JsonProperty("client_secret")
|
| 19 |
+
val clientSecret: String,
|
| 20 |
+
|
| 21 |
+
/** An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. */
|
| 22 |
+
@JsonProperty("organization_id")
|
| 23 |
+
val organizationId: String? = null,
|
| 24 |
+
|
| 25 |
+
/** Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors. */
|
| 26 |
+
@JsonProperty("config")
|
| 27 |
+
val config: Map<String, String>? = null
|
| 28 |
+
)
|
kotlin/src/main/kotlin/com/workos/models/RadarSmsChallengeCodeSessionAuthenticateRequest.kt|
@@ -18,14 +18,6 @@ data class RadarSmsChallengeCodeSessionAuthenticateRequest(
|
|
| 18 |
@JsonProperty("code")
|
| 19 |
val code: String,
|
| 20 |
|
| 21 |
-
/** The ID of the Radar SMS verification being confirmed. */
|
| 22 |
-
@JsonProperty("verification_id")
|
| 23 |
-
val verificationId: String,
|
| 24 |
-
|
| 25 |
-
/** The phone number the Radar SMS challenge was sent to. */
|
| 26 |
-
@JsonProperty("phone_number")
|
| 27 |
-
val phoneNumber: String,
|
| 28 |
-
|
| 29 |
/** The pending authentication token from a previous authentication attempt. */
|
| 30 |
@JsonProperty("pending_authentication_token")
|
| 31 |
val pendingAuthenticationToken: String,
|
|
@@ -34,6 +26,14 @@ data class RadarSmsChallengeCodeSessionAuthenticateRequest(
|
|
| 34 |
@JsonProperty("grant_type")
|
| 35 |
val grantType: String = "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
/** The IP address of the user's request. */
|
| 38 |
@JsonProperty("ip_address")
|
| 39 |
val ipAddress: String? = null,
|
|
|
|
| 18 |
@JsonProperty("code")
|
| 19 |
val code: String,
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
/** The pending authentication token from a previous authentication attempt. */
|
| 22 |
@JsonProperty("pending_authentication_token")
|
| 23 |
val pendingAuthenticationToken: String,
|
|
|
|
| 26 |
@JsonProperty("grant_type")
|
| 27 |
val grantType: String = "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 28 |
|
| 29 |
+
/** The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side. */
|
| 30 |
+
@JsonProperty("verification_id")
|
| 31 |
+
val verificationId: String? = null,
|
| 32 |
+
|
| 33 |
+
/** The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side. */
|
| 34 |
+
@JsonProperty("phone_number")
|
| 35 |
+
val phoneNumber: String? = null,
|
| 36 |
+
|
| 37 |
/** The IP address of the user's request. */
|
| 38 |
@JsonProperty("ip_address")
|
| 39 |
val ipAddress: String? = null,
|
kotlin/src/main/kotlin/com/workos/models/WaitlistUser.kt|
@@ -34,5 +34,9 @@ data class WaitlistUser(
|
|
| 34 |
|
| 35 |
/** Distinguishes the Waitlist User object. */
|
| 36 |
@JsonProperty("object")
|
| 37 |
-
val objectType: String = "waitlist_user"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
)
|
|
|
|
| 34 |
|
| 35 |
/** Distinguishes the Waitlist User object. */
|
| 36 |
@JsonProperty("object")
|
| 37 |
+
val objectType: String = "waitlist_user",
|
| 38 |
+
|
| 39 |
+
/** The unique ID of the Waitlist that the Waitlist User joined. */
|
| 40 |
+
@JsonProperty("waitlist_id")
|
| 41 |
+
val waitlistId: String? = null
|
| 42 |
)
|
kotlin/src/main/kotlin/com/workos/models/WorkOSEvent.kt|
@@ -38,6 +38,7 @@ import java.time.OffsetDateTime
|
|
| 38 |
JsonSubTypes.Type(value = AgentRegistrationDeleted::class, name = "agent.registration.deleted"),
|
| 39 |
JsonSubTypes.Type(value = AgentRegistrationExpired::class, name = "agent.registration.expired"),
|
| 40 |
JsonSubTypes.Type(value = AgentRegistrationOrganizationSwitched::class, name = "agent.registration.organization.switched"),
|
|
|
|
| 41 |
JsonSubTypes.Type(value = AgentRegistrationRevoked::class, name = "agent.registration.revoked"),
|
| 42 |
JsonSubTypes.Type(value = ApiKeyCreated::class, name = "api_key.created"),
|
| 43 |
JsonSubTypes.Type(value = ApiKeyRevoked::class, name = "api_key.revoked"),
|
|
|
|
| 38 |
JsonSubTypes.Type(value = AgentRegistrationDeleted::class, name = "agent.registration.deleted"),
|
| 39 |
JsonSubTypes.Type(value = AgentRegistrationExpired::class, name = "agent.registration.expired"),
|
| 40 |
JsonSubTypes.Type(value = AgentRegistrationOrganizationSwitched::class, name = "agent.registration.organization.switched"),
|
| 41 |
+
JsonSubTypes.Type(value = AgentRegistrationRefreshed::class, name = "agent.registration.refreshed"),
|
| 42 |
JsonSubTypes.Type(value = AgentRegistrationRevoked::class, name = "agent.registration.revoked"),
|
| 43 |
JsonSubTypes.Type(value = ApiKeyCreated::class, name = "api_key.created"),
|
| 44 |
JsonSubTypes.Type(value = ApiKeyRevoked::class, name = "api_key.revoked"),
|
kotlin/src/main/kotlin/com/workos/pipes/Pipes.kt|
@@ -20,7 +20,7 @@ import com.workos.models.DataIntegrationCredentialsInput
|
|
| 20 |
import com.workos.models.DataIntegrationCredentialsResponse
|
| 21 |
import com.workos.models.DataIntegrationsListResponse
|
| 22 |
import com.workos.models.UpdateCustomProviderDefinition
|
| 23 |
-
import com.workos.types.
|
| 24 |
import com.workos.types.PaginationOrder
|
| 25 |
import com.workos.types.PipeConnectedAccountState
|
| 26 |
import kotlinx.coroutines.Dispatchers
|
|
@@ -93,13 +93,13 @@ class Pipes(
|
|
| 93 |
/**
|
| 94 |
* Create a data integration
|
| 95 |
*
|
| 96 |
-
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 97 |
*
|
| 98 |
* @param provider The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 99 |
* @param description An optional description of the Data Integration.
|
| 100 |
* @param enabled Whether the Data Integration is enabled. Defaults to `false`.
|
| 101 |
* @param scopes The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 102 |
-
* @param authMethods How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 103 |
* @param config Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 104 |
* @param credentials The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 105 |
* @param apiKey An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
@@ -114,7 +114,7 @@ class Pipes(
|
|
| 114 |
description: String? = null,
|
| 115 |
enabled: Boolean? = null,
|
| 116 |
scopes: List<String>? = null,
|
| 117 |
-
authMethods: List<
|
| 118 |
config: Map<String, String>? = null,
|
| 119 |
credentials: DataIntegrationCredentialsInput? = null,
|
| 120 |
apiKey: ApiKeyInstallation? = null,
|
|
@@ -157,7 +157,7 @@ class Pipes(
|
|
| 157 |
description: String? = null,
|
| 158 |
enabled: Boolean? = null,
|
| 159 |
scopes: List<String>? = null,
|
| 160 |
-
authMethods: List<
|
| 161 |
config: Map<String, String>? = null,
|
| 162 |
credentials: DataIntegrationCredentialsInput? = null,
|
| 163 |
apiKey: ApiKeyInstallation? = null,
|
|
@@ -445,6 +445,71 @@ class Pipes(
|
|
| 445 |
authorizeDataIntegration(slug, userId, organizationId, returnTo, config, requestOptions)
|
| 446 |
}
|
| 447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
/**
|
| 449 |
* Vend credentials for a connected account
|
| 450 |
*
|
|
|
|
| 20 |
import com.workos.models.DataIntegrationCredentialsResponse
|
| 21 |
import com.workos.models.DataIntegrationsListResponse
|
| 22 |
import com.workos.models.UpdateCustomProviderDefinition
|
| 23 |
+
import com.workos.types.ConnectedAccountAuthMethod
|
| 24 |
import com.workos.types.PaginationOrder
|
| 25 |
import com.workos.types.PipeConnectedAccountState
|
| 26 |
import kotlinx.coroutines.Dispatchers
|
|
|
|
| 93 |
/**
|
| 94 |
* Create a data integration
|
| 95 |
*
|
| 96 |
+
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 97 |
*
|
| 98 |
* @param provider The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 99 |
* @param description An optional description of the Data Integration.
|
| 100 |
* @param enabled Whether the Data Integration is enabled. Defaults to `false`.
|
| 101 |
* @param scopes The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 102 |
+
* @param authMethods How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 103 |
* @param config Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 104 |
* @param credentials The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 105 |
* @param apiKey An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
|
|
| 114 |
description: String? = null,
|
| 115 |
enabled: Boolean? = null,
|
| 116 |
scopes: List<String>? = null,
|
| 117 |
+
authMethods: List<ConnectedAccountAuthMethod>? = null,
|
| 118 |
config: Map<String, String>? = null,
|
| 119 |
credentials: DataIntegrationCredentialsInput? = null,
|
| 120 |
apiKey: ApiKeyInstallation? = null,
|
|
|
|
| 157 |
description: String? = null,
|
| 158 |
enabled: Boolean? = null,
|
| 159 |
scopes: List<String>? = null,
|
| 160 |
+
authMethods: List<ConnectedAccountAuthMethod>? = null,
|
| 161 |
config: Map<String, String>? = null,
|
| 162 |
credentials: DataIntegrationCredentialsInput? = null,
|
| 163 |
apiKey: ApiKeyInstallation? = null,
|
|
|
|
| 445 |
authorizeDataIntegration(slug, userId, organizationId, returnTo, config, requestOptions)
|
| 446 |
}
|
| 447 |
|
| 448 |
+
/**
|
| 449 |
+
* Upsert client credentials for a connected account
|
| 450 |
+
*
|
| 451 |
+
* Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 452 |
+
*
|
| 453 |
+
* @param slug The identifier of the integration.
|
| 454 |
+
* @param userId A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 455 |
+
* @param clientId The OAuth client ID to store for this integration.
|
| 456 |
+
* @param clientSecret The OAuth client secret to store for this integration.
|
| 457 |
+
* @param organizationId An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 458 |
+
* @param config Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 459 |
+
* @param requestOptions per-request overrides (idempotency key, API key, headers, timeout)
|
| 460 |
+
*
|
| 461 |
+
* @return the ConnectedAccount
|
| 462 |
+
*/
|
| 463 |
+
@JvmOverloads
|
| 464 |
+
fun updateDataIntegrationClientCredentials(
|
| 465 |
+
slug: String,
|
| 466 |
+
userId: String,
|
| 467 |
+
clientId: String,
|
| 468 |
+
clientSecret: String,
|
| 469 |
+
organizationId: String? = null,
|
| 470 |
+
config: Map<String, String>? = null,
|
| 471 |
+
requestOptions: RequestOptions? = null
|
| 472 |
+
): ConnectedAccount {
|
| 473 |
+
val body =
|
| 474 |
+
bodyOf(
|
| 475 |
+
"user_id" to userId,
|
| 476 |
+
"client_id" to clientId,
|
| 477 |
+
"client_secret" to clientSecret,
|
| 478 |
+
"organization_id" to organizationId,
|
| 479 |
+
"config" to config
|
| 480 |
+
)
|
| 481 |
+
val config =
|
| 482 |
+
RequestConfig(
|
| 483 |
+
method = "PUT",
|
| 484 |
+
path = "/data-integrations/${encodePathSegment(slug)}/client-credentials",
|
| 485 |
+
body = body,
|
| 486 |
+
requestOptions = requestOptions
|
| 487 |
+
)
|
| 488 |
+
return workos.baseClient.request(config, ConnectedAccount::class.java)
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
/**
|
| 492 |
+
* Coroutine-aware variant of [updateDataIntegrationClientCredentials]. Use this from
|
| 493 |
+
* a `suspend` function or coroutine scope.
|
| 494 |
+
*
|
| 495 |
+
* Delegates to the blocking [updateDataIntegrationClientCredentials] under
|
| 496 |
+
* `withContext(Dispatchers.IO)`, so this is safe to call from any
|
| 497 |
+
* coroutine dispatcher (including `Dispatchers.Main`).
|
| 498 |
+
*/
|
| 499 |
+
@JvmName("updateDataIntegrationClientCredentialsSuspend")
|
| 500 |
+
suspend fun updateDataIntegrationClientCredentialsSuspend(
|
| 501 |
+
slug: String,
|
| 502 |
+
userId: String,
|
| 503 |
+
clientId: String,
|
| 504 |
+
clientSecret: String,
|
| 505 |
+
organizationId: String? = null,
|
| 506 |
+
config: Map<String, String>? = null,
|
| 507 |
+
requestOptions: RequestOptions? = null
|
| 508 |
+
): ConnectedAccount =
|
| 509 |
+
withContext(Dispatchers.IO) {
|
| 510 |
+
updateDataIntegrationClientCredentials(slug, userId, clientId, clientSecret, organizationId, config, requestOptions)
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
/**
|
| 514 |
* Vend credentials for a connected account
|
| 515 |
*
|
kotlin/src/main/kotlin/com/workos/types/AuthenticateResponseAuthenticationMethod.kt|
@@ -23,6 +23,8 @@ enum class AuthenticateResponseAuthenticationMethod(
|
|
| 23 |
GitHubOAuth("GitHubOAuth"),
|
| 24 |
GitLabOAuth("GitLabOAuth"),
|
| 25 |
GoogleOAuth("GoogleOAuth"),
|
|
|
|
|
|
|
| 26 |
IntuitOAuth("IntuitOAuth"),
|
| 27 |
LinkedInOAuth("LinkedInOAuth"),
|
| 28 |
MicrosoftOAuth("MicrosoftOAuth"),
|
|
|
|
| 23 |
GitHubOAuth("GitHubOAuth"),
|
| 24 |
GitLabOAuth("GitLabOAuth"),
|
| 25 |
GoogleOAuth("GoogleOAuth"),
|
| 26 |
+
GrokOAuth("GrokOAuth"),
|
| 27 |
+
XoAuth("XOAuth"),
|
| 28 |
IntuitOAuth("IntuitOAuth"),
|
| 29 |
LinkedInOAuth("LinkedInOAuth"),
|
| 30 |
MicrosoftOAuth("MicrosoftOAuth"),
|
kotlin/src/main/kotlin/com/workos/types/ConnectionDeletedDataConnectionType.kt|
@@ -34,6 +34,8 @@ enum class ConnectionDeletedDataConnectionType(
|
|
| 34 |
GoogleOAuth("GoogleOAuth"),
|
| 35 |
GoogleOidc("GoogleOIDC"),
|
| 36 |
GoogleSAML("GoogleSAML"),
|
|
|
|
|
|
|
| 37 |
IntuitOAuth("IntuitOAuth"),
|
| 38 |
JumpCloudSAML("JumpCloudSAML"),
|
| 39 |
KeycloakSAML("KeycloakSAML"),
|
|
|
|
| 34 |
GoogleOAuth("GoogleOAuth"),
|
| 35 |
GoogleOidc("GoogleOIDC"),
|
| 36 |
GoogleSAML("GoogleSAML"),
|
| 37 |
+
GrokOAuth("GrokOAuth"),
|
| 38 |
+
XoAuth("XOAuth"),
|
| 39 |
IntuitOAuth("IntuitOAuth"),
|
| 40 |
JumpCloudSAML("JumpCloudSAML"),
|
| 41 |
KeycloakSAML("KeycloakSAML"),
|
kotlin/src/main/kotlin/com/workos/types/ConnectionType.kt|
@@ -35,6 +35,8 @@ enum class ConnectionType(
|
|
| 35 |
GoogleOAuth("GoogleOAuth"),
|
| 36 |
GoogleOidc("GoogleOIDC"),
|
| 37 |
GoogleSAML("GoogleSAML"),
|
|
|
|
|
|
|
| 38 |
IntuitOAuth("IntuitOAuth"),
|
| 39 |
JumpCloudSAML("JumpCloudSAML"),
|
| 40 |
KeycloakSAML("KeycloakSAML"),
|
|
|
|
| 35 |
GoogleOAuth("GoogleOAuth"),
|
| 36 |
GoogleOidc("GoogleOIDC"),
|
| 37 |
GoogleSAML("GoogleSAML"),
|
| 38 |
+
GrokOAuth("GrokOAuth"),
|
| 39 |
+
XoAuth("XOAuth"),
|
| 40 |
IntuitOAuth("IntuitOAuth"),
|
| 41 |
JumpCloudSAML("JumpCloudSAML"),
|
| 42 |
KeycloakSAML("KeycloakSAML"),
|
kotlin/src/main/kotlin/com/workos/types/ConnectionsConnectionType.kt|
@@ -33,6 +33,8 @@ enum class ConnectionsConnectionType(
|
|
| 33 |
GoogleOAuth("GoogleOAuth"),
|
| 34 |
GoogleOidc("GoogleOIDC"),
|
| 35 |
GoogleSAML("GoogleSAML"),
|
|
|
|
|
|
|
| 36 |
IntuitOAuth("IntuitOAuth"),
|
| 37 |
JumpCloudSAML("JumpCloudSAML"),
|
| 38 |
KeycloakSAML("KeycloakSAML"),
|
|
|
|
| 33 |
GoogleOAuth("GoogleOAuth"),
|
| 34 |
GoogleOidc("GoogleOIDC"),
|
| 35 |
GoogleSAML("GoogleSAML"),
|
| 36 |
+
GrokOAuth("GrokOAuth"),
|
| 37 |
+
XoAuth("XOAuth"),
|
| 38 |
IntuitOAuth("IntuitOAuth"),
|
| 39 |
JumpCloudSAML("JumpCloudSAML"),
|
| 40 |
KeycloakSAML("KeycloakSAML"),
|
kotlin/src/main/kotlin/com/workos/types/CreateDataIntegrationAuthMethods.kt|
@@ -2,16 +2,5 @@
|
|
| 2 |
|
| 3 |
package com.workos.types
|
| 4 |
|
| 5 |
-
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue
|
| 6 |
-
import com.fasterxml.jackson.annotation.JsonValue
|
| 7 |
-
|
| 8 |
-
/**
|
| 9 |
-
|
| 10 |
-
/** The wire value sent to and received from the API. */
|
| 11 |
-
@JsonValue val value: String
|
| 12 |
-
) {
|
| 13 |
-
@JsonEnumDefaultValue
|
| 14 |
-
Unknown("unknown"),
|
| 15 |
-
OAuth("oauth"),
|
| 16 |
-
ApiKey("api_key")
|
| 17 |
-
}
|
|
|
|
| 2 |
|
| 3 |
package com.workos.types
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
+
/** Alias for [ConnectedAccountAuthMethod]. */
|
| 6 |
+
typealias CreateDataIntegrationAuthMethods = ConnectedAccountAuthMethod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kotlin/src/main/kotlin/com/workos/types/CreateWebhookEndpointEvents.kt|
@@ -17,6 +17,7 @@ enum class CreateWebhookEndpointEvents(
|
|
| 17 |
AgentRegistrationClaimCompleted("agent.registration.claim.completed"),
|
| 18 |
AgentRegistrationCredentialIssued("agent.registration.credential.issued"),
|
| 19 |
AgentRegistrationDeleted("agent.registration.deleted"),
|
|
|
|
| 20 |
AgentRegistrationExpired("agent.registration.expired"),
|
| 21 |
AgentRegistrationOrganizationSwitched("agent.registration.organization.switched"),
|
| 22 |
AgentRegistrationRevoked("agent.registration.revoked"),
|
|
|
|
| 17 |
AgentRegistrationClaimCompleted("agent.registration.claim.completed"),
|
| 18 |
AgentRegistrationCredentialIssued("agent.registration.credential.issued"),
|
| 19 |
AgentRegistrationDeleted("agent.registration.deleted"),
|
| 20 |
+
AgentRegistrationRefreshed("agent.registration.refreshed"),
|
| 21 |
AgentRegistrationExpired("agent.registration.expired"),
|
| 22 |
AgentRegistrationOrganizationSwitched("agent.registration.organization.switched"),
|
| 23 |
AgentRegistrationRevoked("agent.registration.revoked"),
|
kotlin/src/main/kotlin/com/workos/types/UserIdentitiesGetItemProvider.kt|
@@ -18,6 +18,8 @@ enum class UserIdentitiesGetItemProvider(
|
|
| 18 |
GithubOAuth("GithubOAuth"),
|
| 19 |
GitLabOAuth("GitLabOAuth"),
|
| 20 |
GoogleOAuth("GoogleOAuth"),
|
|
|
|
|
|
|
| 21 |
IntuitOAuth("IntuitOAuth"),
|
| 22 |
LinkedInOAuth("LinkedInOAuth"),
|
| 23 |
MicrosoftOAuth("MicrosoftOAuth"),
|
|
|
|
| 18 |
GithubOAuth("GithubOAuth"),
|
| 19 |
GitLabOAuth("GitLabOAuth"),
|
| 20 |
GoogleOAuth("GoogleOAuth"),
|
| 21 |
+
GrokOAuth("GrokOAuth"),
|
| 22 |
+
XoAuth("XOAuth"),
|
| 23 |
IntuitOAuth("IntuitOAuth"),
|
| 24 |
LinkedInOAuth("LinkedInOAuth"),
|
| 25 |
MicrosoftOAuth("MicrosoftOAuth"),
|
kotlin/src/main/kotlin/com/workos/usermanagement/UserManagement.kt|
@@ -668,8 +668,8 @@ class UserManagement(
|
|
| 668 |
* Authenticate
|
| 669 |
*
|
| 670 |
* @param code The one-time code from the Radar SMS challenge.
|
| 671 |
-
* @param verificationId The ID of the Radar SMS verification being confirmed.
|
| 672 |
-
* @param phoneNumber The phone number the Radar SMS challenge was sent to.
|
| 673 |
* @param pendingAuthenticationToken The pending authentication token from a previous authentication attempt.
|
| 674 |
* @param ipAddress The IP address of the user's request.
|
| 675 |
* @param deviceId A unique identifier for the device.
|
|
@@ -680,8 +680,8 @@ class UserManagement(
|
|
| 680 |
@JvmOverloads
|
| 681 |
fun authenticateWithRadarSmsChallenge(
|
| 682 |
code: String,
|
| 683 |
-
verificationId: String,
|
| 684 |
-
phoneNumber: String,
|
| 685 |
pendingAuthenticationToken: String,
|
| 686 |
ipAddress: String? = null,
|
| 687 |
deviceId: String? = null,
|
|
@@ -711,8 +711,8 @@ class UserManagement(
|
|
| 711 |
@JvmName("authenticateWithRadarSmsChallengeSuspend")
|
| 712 |
suspend fun authenticateWithRadarSmsChallengeSuspend(
|
| 713 |
code: String,
|
| 714 |
-
verificationId: String,
|
| 715 |
-
phoneNumber: String,
|
| 716 |
pendingAuthenticationToken: String,
|
| 717 |
ipAddress: String? = null,
|
| 718 |
deviceId: String? = null,
|
|
|
|
| 668 |
* Authenticate
|
| 669 |
*
|
| 670 |
* @param code The one-time code from the Radar SMS challenge.
|
| 671 |
+
* @param verificationId The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
| 672 |
+
* @param phoneNumber The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
| 673 |
* @param pendingAuthenticationToken The pending authentication token from a previous authentication attempt.
|
| 674 |
* @param ipAddress The IP address of the user's request.
|
| 675 |
* @param deviceId A unique identifier for the device.
|
|
|
|
| 680 |
@JvmOverloads
|
| 681 |
fun authenticateWithRadarSmsChallenge(
|
| 682 |
code: String,
|
| 683 |
+
verificationId: String? = null,
|
| 684 |
+
phoneNumber: String? = null,
|
| 685 |
pendingAuthenticationToken: String,
|
| 686 |
ipAddress: String? = null,
|
| 687 |
deviceId: String? = null,
|
|
|
|
| 711 |
@JvmName("authenticateWithRadarSmsChallengeSuspend")
|
| 712 |
suspend fun authenticateWithRadarSmsChallengeSuspend(
|
| 713 |
code: String,
|
| 714 |
+
verificationId: String? = null,
|
| 715 |
+
phoneNumber: String? = null,
|
| 716 |
pendingAuthenticationToken: String,
|
| 717 |
ipAddress: String? = null,
|
| 718 |
deviceId: String? = null,
|
kotlin/src/test/kotlin/com/workos/adminportal/AdminPortalTest.kt|
@@ -26,7 +26,7 @@ class AdminPortalTest : TestBase() {
|
|
| 26 |
assertEquals("sample", result.link)
|
| 27 |
wireMockRule.verify(
|
| 28 |
postRequestedFor(urlPathMatching("/portal/generate_link"))
|
| 29 |
-
.withRequestBody(matchingJsonPath("$.organization"))
|
| 30 |
)
|
| 31 |
}
|
| 32 |
|
|
|
|
| 26 |
assertEquals("sample", result.link)
|
| 27 |
wireMockRule.verify(
|
| 28 |
postRequestedFor(urlPathMatching("/portal/generate_link"))
|
| 29 |
+
.withRequestBody(matchingJsonPath("\$.organization"))
|
| 30 |
)
|
| 31 |
}
|
| 32 |
|
kotlin/src/test/kotlin/com/workos/agents/AgentsTest.kt|
@@ -31,8 +31,8 @@ class AgentsTest : TestBase() {
|
|
| 31 |
assertEquals(false, result.valid)
|
| 32 |
wireMockRule.verify(
|
| 33 |
postRequestedFor(urlPathMatching("/agents/credentials/validate"))
|
| 34 |
-
.withRequestBody(matchingJsonPath("$.type"))
|
| 35 |
-
.withRequestBody(matchingJsonPath("$.credential"))
|
| 36 |
)
|
| 37 |
}
|
| 38 |
|
|
|
|
| 31 |
assertEquals(false, result.valid)
|
| 32 |
wireMockRule.verify(
|
| 33 |
postRequestedFor(urlPathMatching("/agents/credentials/validate"))
|
| 34 |
+
.withRequestBody(matchingJsonPath("\$.type"))
|
| 35 |
+
.withRequestBody(matchingJsonPath("\$.credential"))
|
| 36 |
)
|
| 37 |
}
|
| 38 |
|
kotlin/src/test/kotlin/com/workos/apikeys/ApiKeysTest.kt|
@@ -44,7 +44,7 @@ class ApiKeysTest : TestBase() {
|
|
| 44 |
assertEquals("sample", result.value)
|
| 45 |
wireMockRule.verify(
|
| 46 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/api_keys"))
|
| 47 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 48 |
)
|
| 49 |
}
|
| 50 |
|
|
@@ -55,7 +55,7 @@ class ApiKeysTest : TestBase() {
|
|
| 55 |
assertNotNull(result)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/api_keys/validations"))
|
| 58 |
-
.withRequestBody(matchingJsonPath("$.value"))
|
| 59 |
)
|
| 60 |
}
|
| 61 |
|
|
|
|
| 44 |
assertEquals("sample", result.value)
|
| 45 |
wireMockRule.verify(
|
| 46 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/api_keys"))
|
| 47 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 48 |
)
|
| 49 |
}
|
| 50 |
|
|
|
|
| 55 |
assertNotNull(result)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/api_keys/validations"))
|
| 58 |
+
.withRequestBody(matchingJsonPath("\$.value"))
|
| 59 |
)
|
| 60 |
}
|
| 61 |
|
kotlin/src/test/kotlin/com/workos/auditlogs/AuditLogsTest.kt|
@@ -35,7 +35,7 @@ class AuditLogsTest : TestBase() {
|
|
| 35 |
assertNotNull(result)
|
| 36 |
wireMockRule.verify(
|
| 37 |
putRequestedFor(urlPathMatching("/organizations/sample-arg/audit_logs_retention"))
|
| 38 |
-
.withRequestBody(matchingJsonPath("$.retention_period_in_days"))
|
| 39 |
)
|
| 40 |
}
|
| 41 |
|
|
@@ -87,9 +87,9 @@ class AuditLogsTest : TestBase() {
|
|
| 87 |
assertEquals("sample", result.id)
|
| 88 |
wireMockRule.verify(
|
| 89 |
postRequestedFor(urlPathMatching("/audit_logs/exports"))
|
| 90 |
-
.withRequestBody(matchingJsonPath("$.organization_id"))
|
| 91 |
-
.withRequestBody(matchingJsonPath("$.range_start"))
|
| 92 |
-
.withRequestBody(matchingJsonPath("$.range_end"))
|
| 93 |
)
|
| 94 |
}
|
| 95 |
|
|
|
|
| 35 |
assertNotNull(result)
|
| 36 |
wireMockRule.verify(
|
| 37 |
putRequestedFor(urlPathMatching("/organizations/sample-arg/audit_logs_retention"))
|
| 38 |
+
.withRequestBody(matchingJsonPath("\$.retention_period_in_days"))
|
| 39 |
)
|
| 40 |
}
|
| 41 |
|
|
|
|
| 87 |
assertEquals("sample", result.id)
|
| 88 |
wireMockRule.verify(
|
| 89 |
postRequestedFor(urlPathMatching("/audit_logs/exports"))
|
| 90 |
+
.withRequestBody(matchingJsonPath("\$.organization_id"))
|
| 91 |
+
.withRequestBody(matchingJsonPath("\$.range_start"))
|
| 92 |
+
.withRequestBody(matchingJsonPath("\$.range_end"))
|
| 93 |
)
|
| 94 |
}
|
| 95 |
|
kotlin/src/test/kotlin/com/workos/authorization/AuthorizationTest.kt|
@@ -56,7 +56,7 @@ class AuthorizationTest : TestBase() {
|
|
| 56 |
assertEquals("sample", result.groupId)
|
| 57 |
wireMockRule.verify(
|
| 58 |
postRequestedFor(urlPathMatching("/authorization/groups/sample-arg/role_assignments"))
|
| 59 |
-
.withRequestBody(matchingJsonPath("$.role_slug"))
|
| 60 |
)
|
| 61 |
}
|
| 62 |
|
|
@@ -79,7 +79,7 @@ class AuthorizationTest : TestBase() {
|
|
| 79 |
api().deleteGroupRoleAssignments("sample-arg", "sample-arg")
|
| 80 |
wireMockRule.verify(
|
| 81 |
deleteRequestedFor(urlPathMatching("/authorization/groups/sample-arg/role_assignments"))
|
| 82 |
-
.withRequestBody(matchingJsonPath("$.role_slug"))
|
| 83 |
)
|
| 84 |
}
|
| 85 |
|
|
@@ -114,7 +114,7 @@ class AuthorizationTest : TestBase() {
|
|
| 114 |
assertEquals(false, result.authorized)
|
| 115 |
wireMockRule.verify(
|
| 116 |
postRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/check"))
|
| 117 |
-
.withRequestBody(matchingJsonPath("$.permission_slug"))
|
| 118 |
.withQueryParam("resource_id", absent())
|
| 119 |
.withQueryParam("resource_external_id", absent())
|
| 120 |
.withQueryParam("resource_type_slug", absent())
|
|
@@ -191,7 +191,7 @@ class AuthorizationTest : TestBase() {
|
|
| 191 |
assertEquals("sample", result.organizationMembershipId)
|
| 192 |
wireMockRule.verify(
|
| 193 |
postRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/role_assignments"))
|
| 194 |
-
.withRequestBody(matchingJsonPath("$.role_slug"))
|
| 195 |
.withQueryParam("resource_id", absent())
|
| 196 |
.withQueryParam("resource_external_id", absent())
|
| 197 |
.withQueryParam("resource_type_slug", absent())
|
|
@@ -204,7 +204,7 @@ class AuthorizationTest : TestBase() {
|
|
| 204 |
api().removeRole("sample-arg", resourceTarget = ResourceTarget.ById("sample-arg"), "sample-arg")
|
| 205 |
wireMockRule.verify(
|
| 206 |
deleteRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/role_assignments"))
|
| 207 |
-
.withRequestBody(matchingJsonPath("$.role_slug"))
|
| 208 |
)
|
| 209 |
}
|
| 210 |
|
|
@@ -241,7 +241,7 @@ class AuthorizationTest : TestBase() {
|
|
| 241 |
assertEquals("sample", result.resourceTypeSlug)
|
| 242 |
wireMockRule.verify(
|
| 243 |
postRequestedFor(urlPathMatching("/authorization/organizations/sample-arg/roles"))
|
| 244 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 245 |
)
|
| 246 |
}
|
| 247 |
|
|
@@ -308,7 +308,7 @@ class AuthorizationTest : TestBase() {
|
|
| 308 |
assertEquals("sample", result.resourceTypeSlug)
|
| 309 |
wireMockRule.verify(
|
| 310 |
postRequestedFor(urlPathMatching("/authorization/organizations/sample-arg/roles/sample-arg/permissions"))
|
| 311 |
-
.withRequestBody(matchingJsonPath("$.slug"))
|
| 312 |
)
|
| 313 |
}
|
| 314 |
|
|
@@ -454,10 +454,10 @@ class AuthorizationTest : TestBase() {
|
|
| 454 |
assertEquals("sample", result.externalId)
|
| 455 |
wireMockRule.verify(
|
| 456 |
postRequestedFor(urlPathMatching("/authorization/resources"))
|
| 457 |
-
.withRequestBody(matchingJsonPath("$.external_id"))
|
| 458 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 459 |
-
.withRequestBody(matchingJsonPath("$.resource_type_slug"))
|
| 460 |
-
.withRequestBody(matchingJsonPath("$.organization_id"))
|
| 461 |
.withQueryParam("parent_resource_id", absent())
|
| 462 |
.withQueryParam("parent_resource_external_id", absent())
|
| 463 |
.withQueryParam("parent_resource_type_slug", absent())
|
|
@@ -569,8 +569,8 @@ class AuthorizationTest : TestBase() {
|
|
| 569 |
assertEquals("sample", result.resourceTypeSlug)
|
| 570 |
wireMockRule.verify(
|
| 571 |
postRequestedFor(urlPathMatching("/authorization/roles"))
|
| 572 |
-
.withRequestBody(matchingJsonPath("$.slug"))
|
| 573 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 574 |
)
|
| 575 |
}
|
| 576 |
|
|
@@ -631,7 +631,7 @@ class AuthorizationTest : TestBase() {
|
|
| 631 |
assertEquals("sample", result.resourceTypeSlug)
|
| 632 |
wireMockRule.verify(
|
| 633 |
postRequestedFor(urlPathMatching("/authorization/roles/sample-arg/permissions"))
|
| 634 |
-
.withRequestBody(matchingJsonPath("$.slug"))
|
| 635 |
)
|
| 636 |
}
|
| 637 |
|
|
@@ -679,8 +679,8 @@ class AuthorizationTest : TestBase() {
|
|
| 679 |
assertEquals(false, result.system)
|
| 680 |
wireMockRule.verify(
|
| 681 |
postRequestedFor(urlPathMatching("/authorization/permissions"))
|
| 682 |
-
.withRequestBody(matchingJsonPath("$.slug"))
|
| 683 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 684 |
)
|
| 685 |
}
|
| 686 |
|
|
|
|
| 56 |
assertEquals("sample", result.groupId)
|
| 57 |
wireMockRule.verify(
|
| 58 |
postRequestedFor(urlPathMatching("/authorization/groups/sample-arg/role_assignments"))
|
| 59 |
+
.withRequestBody(matchingJsonPath("\$.role_slug"))
|
| 60 |
)
|
| 61 |
}
|
| 62 |
|
|
|
|
| 79 |
api().deleteGroupRoleAssignments("sample-arg", "sample-arg")
|
| 80 |
wireMockRule.verify(
|
| 81 |
deleteRequestedFor(urlPathMatching("/authorization/groups/sample-arg/role_assignments"))
|
| 82 |
+
.withRequestBody(matchingJsonPath("\$.role_slug"))
|
| 83 |
)
|
| 84 |
}
|
| 85 |
|
|
|
|
| 114 |
assertEquals(false, result.authorized)
|
| 115 |
wireMockRule.verify(
|
| 116 |
postRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/check"))
|
| 117 |
+
.withRequestBody(matchingJsonPath("\$.permission_slug"))
|
| 118 |
.withQueryParam("resource_id", absent())
|
| 119 |
.withQueryParam("resource_external_id", absent())
|
| 120 |
.withQueryParam("resource_type_slug", absent())
|
|
|
|
| 191 |
assertEquals("sample", result.organizationMembershipId)
|
| 192 |
wireMockRule.verify(
|
| 193 |
postRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/role_assignments"))
|
| 194 |
+
.withRequestBody(matchingJsonPath("\$.role_slug"))
|
| 195 |
.withQueryParam("resource_id", absent())
|
| 196 |
.withQueryParam("resource_external_id", absent())
|
| 197 |
.withQueryParam("resource_type_slug", absent())
|
|
|
|
| 204 |
api().removeRole("sample-arg", resourceTarget = ResourceTarget.ById("sample-arg"), "sample-arg")
|
| 205 |
wireMockRule.verify(
|
| 206 |
deleteRequestedFor(urlPathMatching("/authorization/organization_memberships/sample-arg/role_assignments"))
|
| 207 |
+
.withRequestBody(matchingJsonPath("\$.role_slug"))
|
| 208 |
)
|
| 209 |
}
|
| 210 |
|
|
|
|
| 241 |
assertEquals("sample", result.resourceTypeSlug)
|
| 242 |
wireMockRule.verify(
|
| 243 |
postRequestedFor(urlPathMatching("/authorization/organizations/sample-arg/roles"))
|
| 244 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 245 |
)
|
| 246 |
}
|
| 247 |
|
|
|
|
| 308 |
assertEquals("sample", result.resourceTypeSlug)
|
| 309 |
wireMockRule.verify(
|
| 310 |
postRequestedFor(urlPathMatching("/authorization/organizations/sample-arg/roles/sample-arg/permissions"))
|
| 311 |
+
.withRequestBody(matchingJsonPath("\$.slug"))
|
| 312 |
)
|
| 313 |
}
|
| 314 |
|
|
|
|
| 454 |
assertEquals("sample", result.externalId)
|
| 455 |
wireMockRule.verify(
|
| 456 |
postRequestedFor(urlPathMatching("/authorization/resources"))
|
| 457 |
+
.withRequestBody(matchingJsonPath("\$.external_id"))
|
| 458 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 459 |
+
.withRequestBody(matchingJsonPath("\$.resource_type_slug"))
|
| 460 |
+
.withRequestBody(matchingJsonPath("\$.organization_id"))
|
| 461 |
.withQueryParam("parent_resource_id", absent())
|
| 462 |
.withQueryParam("parent_resource_external_id", absent())
|
| 463 |
.withQueryParam("parent_resource_type_slug", absent())
|
|
|
|
| 569 |
assertEquals("sample", result.resourceTypeSlug)
|
| 570 |
wireMockRule.verify(
|
| 571 |
postRequestedFor(urlPathMatching("/authorization/roles"))
|
| 572 |
+
.withRequestBody(matchingJsonPath("\$.slug"))
|
| 573 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 574 |
)
|
| 575 |
}
|
| 576 |
|
|
|
|
| 631 |
assertEquals("sample", result.resourceTypeSlug)
|
| 632 |
wireMockRule.verify(
|
| 633 |
postRequestedFor(urlPathMatching("/authorization/roles/sample-arg/permissions"))
|
| 634 |
+
.withRequestBody(matchingJsonPath("\$.slug"))
|
| 635 |
)
|
| 636 |
}
|
| 637 |
|
|
|
|
| 679 |
assertEquals(false, result.system)
|
| 680 |
wireMockRule.verify(
|
| 681 |
postRequestedFor(urlPathMatching("/authorization/permissions"))
|
| 682 |
+
.withRequestBody(matchingJsonPath("\$.slug"))
|
| 683 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 684 |
)
|
| 685 |
}
|
| 686 |
|
kotlin/src/test/kotlin/com/workos/clientapi/ClientApiTest.kt|
@@ -26,8 +26,8 @@ class ClientApiTest : TestBase() {
|
|
| 26 |
assertEquals("sample", result.token)
|
| 27 |
wireMockRule.verify(
|
| 28 |
postRequestedFor(urlPathMatching("/client/token"))
|
| 29 |
-
.withRequestBody(matchingJsonPath("$.organization_id"))
|
| 30 |
-
.withRequestBody(matchingJsonPath("$.user_id"))
|
| 31 |
)
|
| 32 |
}
|
| 33 |
|
|
|
|
| 26 |
assertEquals("sample", result.token)
|
| 27 |
wireMockRule.verify(
|
| 28 |
postRequestedFor(urlPathMatching("/client/token"))
|
| 29 |
+
.withRequestBody(matchingJsonPath("\$.organization_id"))
|
| 30 |
+
.withRequestBody(matchingJsonPath("\$.user_id"))
|
| 31 |
)
|
| 32 |
}
|
| 33 |
|
kotlin/src/test/kotlin/com/workos/groups/GroupsTest.kt|
@@ -42,7 +42,7 @@ class GroupsTest : TestBase() {
|
|
| 42 |
assertEquals("sample", result.name)
|
| 43 |
wireMockRule.verify(
|
| 44 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/groups"))
|
| 45 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 46 |
)
|
| 47 |
}
|
| 48 |
|
|
@@ -115,7 +115,7 @@ class GroupsTest : TestBase() {
|
|
| 115 |
assertEquals("sample", result.name)
|
| 116 |
wireMockRule.verify(
|
| 117 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/groups/sample-arg/organization-memberships"))
|
| 118 |
-
.withRequestBody(matchingJsonPath("$.organization_membership_id"))
|
| 119 |
)
|
| 120 |
}
|
| 121 |
|
|
|
|
| 42 |
assertEquals("sample", result.name)
|
| 43 |
wireMockRule.verify(
|
| 44 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/groups"))
|
| 45 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 46 |
)
|
| 47 |
}
|
| 48 |
|
|
|
|
| 115 |
assertEquals("sample", result.name)
|
| 116 |
wireMockRule.verify(
|
| 117 |
postRequestedFor(urlPathMatching("/organizations/sample-arg/groups/sample-arg/organization-memberships"))
|
| 118 |
+
.withRequestBody(matchingJsonPath("\$.organization_membership_id"))
|
| 119 |
)
|
| 120 |
}
|
| 121 |
|
kotlin/src/test/kotlin/com/workos/models/GeneratedModelRoundTripTest.kt|
@@ -501,6 +501,16 @@ class GeneratedModelRoundTripTest {
|
|
| 501 |
assertEquals(tree1, tree2)
|
| 502 |
}
|
| 503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
@Test
|
| 505 |
fun `AgentRegistrationRevokedData round-trips through Jackson`() {
|
| 506 |
val json = "{\"agent_registration_id\": \"sample\"}"
|
|
|
|
| 501 |
assertEquals(tree1, tree2)
|
| 502 |
}
|
| 503 |
|
| 504 |
+
@Test
|
| 505 |
+
fun `AgentRegistrationRefreshedData round-trips through Jackson`() {
|
| 506 |
+
val json = "{\"agent_registration_id\": \"sample\"}"
|
| 507 |
+
val parsed = mapper.readValue(json, AgentRegistrationRefreshedData::class.java)
|
| 508 |
+
val reserialized = mapper.writeValueAsString(parsed)
|
| 509 |
+
val tree1 = mapper.readTree(json)
|
| 510 |
+
val tree2 = mapper.readTree(reserialized)
|
| 511 |
+
assertEquals(tree1, tree2)
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
@Test
|
| 515 |
fun `AgentRegistrationRevokedData round-trips through Jackson`() {
|
| 516 |
val json = "{\"agent_registration_id\": \"sample\"}"
|
kotlin/src/test/kotlin/com/workos/multifactorauth/MultiFactorAuthTest.kt|
@@ -33,7 +33,7 @@ class MultiFactorAuthTest : TestBase() {
|
|
| 33 |
assertEquals(false, result.valid)
|
| 34 |
wireMockRule.verify(
|
| 35 |
postRequestedFor(urlPathMatching("/auth/challenges/sample-arg/verify"))
|
| 36 |
-
.withRequestBody(matchingJsonPath("$.code"))
|
| 37 |
)
|
| 38 |
}
|
| 39 |
|
|
@@ -55,7 +55,7 @@ class MultiFactorAuthTest : TestBase() {
|
|
| 55 |
assertEquals("sample", result.id)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/auth/factors/enroll"))
|
| 58 |
-
.withRequestBody(matchingJsonPath("$.type"))
|
| 59 |
)
|
| 60 |
}
|
| 61 |
|
|
@@ -123,7 +123,7 @@ class MultiFactorAuthTest : TestBase() {
|
|
| 123 |
assertNotNull(result)
|
| 124 |
wireMockRule.verify(
|
| 125 |
postRequestedFor(urlPathMatching("/user_management/users/sample-arg/auth_factors"))
|
| 126 |
-
.withRequestBody(matchingJsonPath("$.type"))
|
| 127 |
)
|
| 128 |
}
|
| 129 |
|
|
|
|
| 33 |
assertEquals(false, result.valid)
|
| 34 |
wireMockRule.verify(
|
| 35 |
postRequestedFor(urlPathMatching("/auth/challenges/sample-arg/verify"))
|
| 36 |
+
.withRequestBody(matchingJsonPath("\$.code"))
|
| 37 |
)
|
| 38 |
}
|
| 39 |
|
|
|
|
| 55 |
assertEquals("sample", result.id)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/auth/factors/enroll"))
|
| 58 |
+
.withRequestBody(matchingJsonPath("\$.type"))
|
| 59 |
)
|
| 60 |
}
|
| 61 |
|
|
|
|
| 123 |
assertNotNull(result)
|
| 124 |
wireMockRule.verify(
|
| 125 |
postRequestedFor(urlPathMatching("/user_management/users/sample-arg/auth_factors"))
|
| 126 |
+
.withRequestBody(matchingJsonPath("\$.type"))
|
| 127 |
)
|
| 128 |
}
|
| 129 |
|
kotlin/src/test/kotlin/com/workos/organizationdomains/OrganizationDomainsTest.kt|
@@ -35,8 +35,8 @@ class OrganizationDomainsTest : TestBase() {
|
|
| 35 |
assertEquals("sample", result.domain)
|
| 36 |
wireMockRule.verify(
|
| 37 |
postRequestedFor(urlPathMatching("/organization_domains"))
|
| 38 |
-
.withRequestBody(matchingJsonPath("$.domain"))
|
| 39 |
-
.withRequestBody(matchingJsonPath("$.organization_id"))
|
| 40 |
)
|
| 41 |
}
|
| 42 |
|
|
|
|
| 35 |
assertEquals("sample", result.domain)
|
| 36 |
wireMockRule.verify(
|
| 37 |
postRequestedFor(urlPathMatching("/organization_domains"))
|
| 38 |
+
.withRequestBody(matchingJsonPath("\$.domain"))
|
| 39 |
+
.withRequestBody(matchingJsonPath("\$.organization_id"))
|
| 40 |
)
|
| 41 |
}
|
| 42 |
|
kotlin/src/test/kotlin/com/workos/organizationmembership/OrganizationMembershipServiceTest.kt|
@@ -55,8 +55,8 @@ class OrganizationMembershipServiceTest : TestBase() {
|
|
| 55 |
assertEquals(false, result.directoryManaged)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/user_management/organization_memberships"))
|
| 58 |
-
.withRequestBody(matchingJsonPath("$.user_id"))
|
| 59 |
-
.withRequestBody(matchingJsonPath("$.organization_id"))
|
| 60 |
.withQueryParam("role_slug", absent())
|
| 61 |
.withQueryParam("role_slugs", absent())
|
| 62 |
)
|
|
|
|
| 55 |
assertEquals(false, result.directoryManaged)
|
| 56 |
wireMockRule.verify(
|
| 57 |
postRequestedFor(urlPathMatching("/user_management/organization_memberships"))
|
| 58 |
+
.withRequestBody(matchingJsonPath("\$.user_id"))
|
| 59 |
+
.withRequestBody(matchingJsonPath("\$.organization_id"))
|
| 60 |
.withQueryParam("role_slug", absent())
|
| 61 |
.withQueryParam("role_slugs", absent())
|
| 62 |
)
|
kotlin/src/test/kotlin/com/workos/organizations/OrganizationsTest.kt|
@@ -41,7 +41,7 @@ class OrganizationsTest : TestBase() {
|
|
| 41 |
assertEquals("sample", result.name)
|
| 42 |
wireMockRule.verify(
|
| 43 |
postRequestedFor(urlPathMatching("/organizations"))
|
| 44 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 45 |
)
|
| 46 |
}
|
| 47 |
|
|
|
|
| 41 |
assertEquals("sample", result.name)
|
| 42 |
wireMockRule.verify(
|
| 43 |
postRequestedFor(urlPathMatching("/organizations"))
|
| 44 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 45 |
)
|
| 46 |
}
|
| 47 |
|
kotlin/src/test/kotlin/com/workos/pipes/PipesTest.kt|
@@ -34,8 +34,8 @@ class PipesTest : TestBase() {
|
|
| 34 |
200,
|
| 35 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 36 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 37 |
-
"\"credentials\":
|
| 38 |
-
"\"
|
| 39 |
)
|
| 40 |
val result = api().createDataIntegration("sample-arg")
|
| 41 |
assertNotNull(result)
|
|
@@ -58,8 +58,8 @@ class PipesTest : TestBase() {
|
|
| 58 |
200,
|
| 59 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 60 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 61 |
-
"\"credentials\":
|
| 62 |
-
"\"
|
| 63 |
)
|
| 64 |
val result = api().getDataIntegration("sample-arg")
|
| 65 |
assertNotNull(result)
|
|
@@ -78,8 +78,8 @@ class PipesTest : TestBase() {
|
|
| 78 |
200,
|
| 79 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 80 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 81 |
-
"\"credentials\":
|
| 82 |
-
"\"
|
| 83 |
)
|
| 84 |
val result = api().updateDataIntegration("sample-arg")
|
| 85 |
assertNotNull(result)
|
|
@@ -130,6 +130,29 @@ class PipesTest : TestBase() {
|
|
| 130 |
)
|
| 131 |
}
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
@Test
|
| 134 |
fun `createDataIntegrationCredential returns a typed response`() {
|
| 135 |
stubResponse("POST", "/data-integrations/sample-arg/credentials", 200, "{}")
|
|
|
|
| 34 |
200,
|
| 35 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 36 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 37 |
+
"\"credentials\": null, \"installation\": null, \"config\": {}, \"custom_provider\": null, \"created_at\": " +
|
| 38 |
+
"\"2024-01-01T00:00:00Z\", \"updated_at\": \"2024-01-01T00:00:00Z\"}"
|
| 39 |
)
|
| 40 |
val result = api().createDataIntegration("sample-arg")
|
| 41 |
assertNotNull(result)
|
|
|
|
| 58 |
200,
|
| 59 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 60 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 61 |
+
"\"credentials\": null, \"installation\": null, \"config\": {}, \"custom_provider\": null, \"created_at\": " +
|
| 62 |
+
"\"2024-01-01T00:00:00Z\", \"updated_at\": \"2024-01-01T00:00:00Z\"}"
|
| 63 |
)
|
| 64 |
val result = api().getDataIntegration("sample-arg")
|
| 65 |
assertNotNull(result)
|
|
|
|
| 78 |
200,
|
| 79 |
"{\"object\": \"data_integration\", \"id\": \"sample\", \"slug\": \"sample\", \"integration_type\": \"sample\", \"description\": " +
|
| 80 |
"null, \"enabled\": false, \"state\": \"valid\", \"scopes\": null, \"redirect_uri\": \"sample\", \"auth_methods\": [], " +
|
| 81 |
+
"\"credentials\": null, \"installation\": null, \"config\": {}, \"custom_provider\": null, \"created_at\": " +
|
| 82 |
+
"\"2024-01-01T00:00:00Z\", \"updated_at\": \"2024-01-01T00:00:00Z\"}"
|
| 83 |
)
|
| 84 |
val result = api().updateDataIntegration("sample-arg")
|
| 85 |
assertNotNull(result)
|
|
|
|
| 130 |
)
|
| 131 |
}
|
| 132 |
|
| 133 |
+
@Test
|
| 134 |
+
fun `updateDataIntegrationClientCredentials returns a typed response`() {
|
| 135 |
+
stubResponse(
|
| 136 |
+
"PUT",
|
| 137 |
+
"/data-integrations/sample-arg/client-credentials",
|
| 138 |
+
200,
|
| 139 |
+
"{\"object\": \"connected_account\", \"id\": \"sample\", \"user_id\": null, \"organization_id\": null, \"scopes\": [], " +
|
| 140 |
+
"\"state\": \"connected\", \"created_at\": \"sample\", \"updated_at\": \"sample\"}"
|
| 141 |
+
)
|
| 142 |
+
val result = api().updateDataIntegrationClientCredentials("sample-arg", "sample-arg", "sample-arg", "sample-arg")
|
| 143 |
+
assertNotNull(result)
|
| 144 |
+
assertEquals("connected_account", result.objectType)
|
| 145 |
+
assertEquals("sample", result.id)
|
| 146 |
+
assertEquals("sample", result.createdAt)
|
| 147 |
+
assertEquals("sample", result.updatedAt)
|
| 148 |
+
wireMockRule.verify(
|
| 149 |
+
putRequestedFor(urlPathMatching("/data-integrations/sample-arg/client-credentials"))
|
| 150 |
+
.withRequestBody(matchingJsonPath("\$.user_id"))
|
| 151 |
+
.withRequestBody(matchingJsonPath("\$.client_id"))
|
| 152 |
+
.withRequestBody(matchingJsonPath("\$.client_secret"))
|
| 153 |
+
)
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
@Test
|
| 157 |
fun `createDataIntegrationCredential returns a typed response`() {
|
| 158 |
stubResponse("POST", "/data-integrations/sample-arg/credentials", 200, "{}")
|
kotlin/src/test/kotlin/com/workos/radar/RadarTest.kt|
@@ -37,11 +37,11 @@ class RadarTest : TestBase() {
|
|
| 37 |
assertEquals("sample", result.attemptId)
|
| 38 |
wireMockRule.verify(
|
| 39 |
postRequestedFor(urlPathMatching("/radar/attempts"))
|
| 40 |
-
.withRequestBody(matchingJsonPath("$.ip_address"))
|
| 41 |
-
.withRequestBody(matchingJsonPath("$.user_agent"))
|
| 42 |
-
.withRequestBody(matchingJsonPath("$.email"))
|
| 43 |
-
.withRequestBody(matchingJsonPath("$.auth_method"))
|
| 44 |
-
.withRequestBody(matchingJsonPath("$.action"))
|
| 45 |
)
|
| 46 |
}
|
| 47 |
|
|
@@ -59,7 +59,7 @@ class RadarTest : TestBase() {
|
|
| 59 |
assertEquals("sample", result.message)
|
| 60 |
wireMockRule.verify(
|
| 61 |
postRequestedFor(urlPathMatching("/radar/lists/sample-arg/sample-arg"))
|
| 62 |
-
.withRequestBody(matchingJsonPath("$.entry"))
|
| 63 |
)
|
| 64 |
}
|
| 65 |
|
|
@@ -69,7 +69,7 @@ class RadarTest : TestBase() {
|
|
| 69 |
api().removeListEntry("sample-arg", "sample-arg", "sample-arg")
|
| 70 |
wireMockRule.verify(
|
| 71 |
deleteRequestedFor(urlPathMatching("/radar/lists/sample-arg/sample-arg"))
|
| 72 |
-
.withRequestBody(matchingJsonPath("$.entry"))
|
| 73 |
)
|
| 74 |
}
|
| 75 |
|
|
|
|
| 37 |
assertEquals("sample", result.attemptId)
|
| 38 |
wireMockRule.verify(
|
| 39 |
postRequestedFor(urlPathMatching("/radar/attempts"))
|
| 40 |
+
.withRequestBody(matchingJsonPath("\$.ip_address"))
|
| 41 |
+
.withRequestBody(matchingJsonPath("\$.user_agent"))
|
| 42 |
+
.withRequestBody(matchingJsonPath("\$.email"))
|
| 43 |
+
.withRequestBody(matchingJsonPath("\$.auth_method"))
|
| 44 |
+
.withRequestBody(matchingJsonPath("\$.action"))
|
| 45 |
)
|
| 46 |
}
|
| 47 |
|
|
|
|
| 59 |
assertEquals("sample", result.message)
|
| 60 |
wireMockRule.verify(
|
| 61 |
postRequestedFor(urlPathMatching("/radar/lists/sample-arg/sample-arg"))
|
| 62 |
+
.withRequestBody(matchingJsonPath("\$.entry"))
|
| 63 |
)
|
| 64 |
}
|
| 65 |
|
|
|
|
| 69 |
api().removeListEntry("sample-arg", "sample-arg", "sample-arg")
|
| 70 |
wireMockRule.verify(
|
| 71 |
deleteRequestedFor(urlPathMatching("/radar/lists/sample-arg/sample-arg"))
|
| 72 |
+
.withRequestBody(matchingJsonPath("\$.entry"))
|
| 73 |
)
|
| 74 |
}
|
| 75 |
|
kotlin/src/test/kotlin/com/workos/usermanagement/UserManagementTest.kt|
@@ -192,7 +192,7 @@ class UserManagementTest : TestBase() {
|
|
| 192 |
"\"2024-01-01T00:00:00Z\", \"updated_at\": \"2024-01-01T00:00:00Z\"}, \"access_token\": \"sample\", \"refresh_token\": " +
|
| 193 |
"\"sample\"}"
|
| 194 |
)
|
| 195 |
-
val result = api().authenticateWithRadarSmsChallenge("sample-arg", "sample-arg"
|
| 196 |
assertNotNull(result)
|
| 197 |
assertEquals("sample", result.accessToken)
|
| 198 |
assertEquals("sample", result.refreshToken)
|
|
|
|
| 192 |
"\"2024-01-01T00:00:00Z\", \"updated_at\": \"2024-01-01T00:00:00Z\"}, \"access_token\": \"sample\", \"refresh_token\": " +
|
| 193 |
"\"sample\"}"
|
| 194 |
)
|
| 195 |
+
val result = api().authenticateWithRadarSmsChallenge("sample-arg", "sample-arg")
|
| 196 |
assertNotNull(result)
|
| 197 |
assertEquals("sample", result.accessToken)
|
| 198 |
assertEquals("sample", result.refreshToken)
|
kotlin/src/test/kotlin/com/workos/vault/VaultTest.kt|
@@ -54,7 +54,7 @@ class VaultTest : TestBase() {
|
|
| 54 |
assertEquals("sample", result.id)
|
| 55 |
wireMockRule.verify(
|
| 56 |
postRequestedFor(urlPathMatching("/vault/v1/keys/decrypt"))
|
| 57 |
-
.withRequestBody(matchingJsonPath("$.keys"))
|
| 58 |
)
|
| 59 |
}
|
| 60 |
|
|
@@ -73,7 +73,7 @@ class VaultTest : TestBase() {
|
|
| 73 |
assertEquals("sample", result.id)
|
| 74 |
wireMockRule.verify(
|
| 75 |
postRequestedFor(urlPathMatching("/vault/v1/keys/rekey"))
|
| 76 |
-
.withRequestBody(matchingJsonPath("$.encrypted_keys"))
|
| 77 |
)
|
| 78 |
}
|
| 79 |
|
|
@@ -100,8 +100,8 @@ class VaultTest : TestBase() {
|
|
| 100 |
assertEquals("sample", result.keyId)
|
| 101 |
wireMockRule.verify(
|
| 102 |
postRequestedFor(urlPathMatching("/vault/v1/kv"))
|
| 103 |
-
.withRequestBody(matchingJsonPath("$.name"))
|
| 104 |
-
.withRequestBody(matchingJsonPath("$.value"))
|
| 105 |
)
|
| 106 |
}
|
| 107 |
|
|
@@ -154,7 +154,7 @@ class VaultTest : TestBase() {
|
|
| 154 |
assertEquals("sample", result.name)
|
| 155 |
wireMockRule.verify(
|
| 156 |
putRequestedFor(urlPathMatching("/vault/v1/kv/sample-arg"))
|
| 157 |
-
.withRequestBody(matchingJsonPath("$.value"))
|
| 158 |
)
|
| 159 |
}
|
| 160 |
|
|
|
|
| 54 |
assertEquals("sample", result.id)
|
| 55 |
wireMockRule.verify(
|
| 56 |
postRequestedFor(urlPathMatching("/vault/v1/keys/decrypt"))
|
| 57 |
+
.withRequestBody(matchingJsonPath("\$.keys"))
|
| 58 |
)
|
| 59 |
}
|
| 60 |
|
|
|
|
| 73 |
assertEquals("sample", result.id)
|
| 74 |
wireMockRule.verify(
|
| 75 |
postRequestedFor(urlPathMatching("/vault/v1/keys/rekey"))
|
| 76 |
+
.withRequestBody(matchingJsonPath("\$.encrypted_keys"))
|
| 77 |
)
|
| 78 |
}
|
| 79 |
|
|
|
|
| 100 |
assertEquals("sample", result.keyId)
|
| 101 |
wireMockRule.verify(
|
| 102 |
postRequestedFor(urlPathMatching("/vault/v1/kv"))
|
| 103 |
+
.withRequestBody(matchingJsonPath("\$.name"))
|
| 104 |
+
.withRequestBody(matchingJsonPath("\$.value"))
|
| 105 |
)
|
| 106 |
}
|
| 107 |
|
|
|
|
| 154 |
assertEquals("sample", result.name)
|
| 155 |
wireMockRule.verify(
|
| 156 |
putRequestedFor(urlPathMatching("/vault/v1/kv/sample-arg"))
|
| 157 |
+
.withRequestBody(matchingJsonPath("\$.value"))
|
| 158 |
)
|
| 159 |
}
|
| 160 |
|
kotlin/src/test/kotlin/com/workos/webhooks/WebhooksTest.kt|
@@ -43,7 +43,7 @@ class WebhooksTest : TestBase() {
|
|
| 43 |
assertEquals("sample", result.secret)
|
| 44 |
wireMockRule.verify(
|
| 45 |
postRequestedFor(urlPathMatching("/webhook_endpoints"))
|
| 46 |
-
.withRequestBody(matchingJsonPath("$.endpoint_url"))
|
| 47 |
)
|
| 48 |
}
|
|
|
|
| 43 |
assertEquals("sample", result.secret)
|
| 44 |
wireMockRule.verify(
|
| 45 |
postRequestedFor(urlPathMatching("/webhook_endpoints"))
|
| 46 |
+
.withRequestBody(matchingJsonPath("\$.endpoint_url"))
|
| 47 |
)
|
| 48 |
}
|
All files in this language are hidden by the current filters.
code: 20 ยท tests: 13 ยท manifest: 1
php/.oagen-manifest.json|
@@ -37,6 +37,8 @@
|
|
| 37 |
"lib/Resource/AgentRegistrationKind.php",
|
| 38 |
"lib/Resource/AgentRegistrationOrganizationSwitched.php",
|
| 39 |
"lib/Resource/AgentRegistrationOrganizationSwitchedData.php",
|
|
|
|
|
|
|
| 40 |
"lib/Resource/AgentRegistrationRevoked.php",
|
| 41 |
"lib/Resource/AgentRegistrationRevokedData.php",
|
| 42 |
"lib/Resource/AgentRegistrationStatus.php",
|
|
@@ -198,7 +200,6 @@
|
|
| 198 |
"lib/Resource/CreateAuthorizationResource.php",
|
| 199 |
"lib/Resource/CreateCORSOrigin.php",
|
| 200 |
"lib/Resource/CreateDataIntegration.php",
|
| 201 |
-
"lib/Resource/CreateDataIntegrationAuthMethods.php",
|
| 202 |
"lib/Resource/CreateDataKeyRequest.php",
|
| 203 |
"lib/Resource/CreateDataKeyResponse.php",
|
| 204 |
"lib/Resource/CreateGroup.php",
|
|
@@ -250,6 +251,7 @@
|
|
| 250 |
"lib/Resource/DataIntegrationsListResponseDataConnectedAccount.php",
|
| 251 |
"lib/Resource/DataIntegrationsListResponseDataOwnership.php",
|
| 252 |
"lib/Resource/DataIntegrationsUpsertApiKeyRequest.php",
|
|
|
|
| 253 |
"lib/Resource/DataIntegrationsVendCredentialsRequest.php",
|
| 254 |
"lib/Resource/DecryptRequest.php",
|
| 255 |
"lib/Resource/DecryptResponse.php",
|
|
@@ -666,6 +668,8 @@
|
|
| 666 |
"tests/Fixtures/agent_registration_expired_data.json",
|
| 667 |
"tests/Fixtures/agent_registration_organization_switched.json",
|
| 668 |
"tests/Fixtures/agent_registration_organization_switched_data.json",
|
|
|
|
|
|
|
| 669 |
"tests/Fixtures/agent_registration_revoked.json",
|
| 670 |
"tests/Fixtures/agent_registration_revoked_data.json",
|
| 671 |
"tests/Fixtures/api_key.json",
|
|
@@ -848,6 +852,7 @@
|
|
| 848 |
"tests/Fixtures/data_integrations_list_response_data.json",
|
| 849 |
"tests/Fixtures/data_integrations_list_response_data_connected_account.json",
|
| 850 |
"tests/Fixtures/data_integrations_upsert_api_key_request.json",
|
|
|
|
| 851 |
"tests/Fixtures/data_integrations_vend_credentials_request.json",
|
| 852 |
"tests/Fixtures/decrypt_request.json",
|
| 853 |
"tests/Fixtures/decrypt_response.json",
|
|
@@ -1506,6 +1511,10 @@
|
|
| 1506 |
"sdkMethod": "authorizeDataIntegration",
|
| 1507 |
"service": "pipes"
|
| 1508 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1509 |
"POST /data-integrations/{slug}/credentials": {
|
| 1510 |
"sdkMethod": "createDataIntegrationCredential",
|
| 1511 |
"service": "pipes"
|
|
|
|
| 37 |
"lib/Resource/AgentRegistrationKind.php",
|
| 38 |
"lib/Resource/AgentRegistrationOrganizationSwitched.php",
|
| 39 |
"lib/Resource/AgentRegistrationOrganizationSwitchedData.php",
|
| 40 |
+
"lib/Resource/AgentRegistrationRefreshed.php",
|
| 41 |
+
"lib/Resource/AgentRegistrationRefreshedData.php",
|
| 42 |
"lib/Resource/AgentRegistrationRevoked.php",
|
| 43 |
"lib/Resource/AgentRegistrationRevokedData.php",
|
| 44 |
"lib/Resource/AgentRegistrationStatus.php",
|
|
|
|
| 200 |
"lib/Resource/CreateAuthorizationResource.php",
|
| 201 |
"lib/Resource/CreateCORSOrigin.php",
|
| 202 |
"lib/Resource/CreateDataIntegration.php",
|
|
|
|
| 203 |
"lib/Resource/CreateDataKeyRequest.php",
|
| 204 |
"lib/Resource/CreateDataKeyResponse.php",
|
| 205 |
"lib/Resource/CreateGroup.php",
|
|
|
|
| 251 |
"lib/Resource/DataIntegrationsListResponseDataConnectedAccount.php",
|
| 252 |
"lib/Resource/DataIntegrationsListResponseDataOwnership.php",
|
| 253 |
"lib/Resource/DataIntegrationsUpsertApiKeyRequest.php",
|
| 254 |
+
"lib/Resource/DataIntegrationsUpsertClientCredentialsRequest.php",
|
| 255 |
"lib/Resource/DataIntegrationsVendCredentialsRequest.php",
|
| 256 |
"lib/Resource/DecryptRequest.php",
|
| 257 |
"lib/Resource/DecryptResponse.php",
|
|
|
|
| 668 |
"tests/Fixtures/agent_registration_expired_data.json",
|
| 669 |
"tests/Fixtures/agent_registration_organization_switched.json",
|
| 670 |
"tests/Fixtures/agent_registration_organization_switched_data.json",
|
| 671 |
+
"tests/Fixtures/agent_registration_refreshed.json",
|
| 672 |
+
"tests/Fixtures/agent_registration_refreshed_data.json",
|
| 673 |
"tests/Fixtures/agent_registration_revoked.json",
|
| 674 |
"tests/Fixtures/agent_registration_revoked_data.json",
|
| 675 |
"tests/Fixtures/api_key.json",
|
|
|
|
| 852 |
"tests/Fixtures/data_integrations_list_response_data.json",
|
| 853 |
"tests/Fixtures/data_integrations_list_response_data_connected_account.json",
|
| 854 |
"tests/Fixtures/data_integrations_upsert_api_key_request.json",
|
| 855 |
+
"tests/Fixtures/data_integrations_upsert_client_credentials_request.json",
|
| 856 |
"tests/Fixtures/data_integrations_vend_credentials_request.json",
|
| 857 |
"tests/Fixtures/decrypt_request.json",
|
| 858 |
"tests/Fixtures/decrypt_response.json",
|
|
|
|
| 1511 |
"sdkMethod": "authorizeDataIntegration",
|
| 1512 |
"service": "pipes"
|
| 1513 |
},
|
| 1514 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1515 |
+
"sdkMethod": "updateDataIntegrationClientCredentials",
|
| 1516 |
+
"service": "pipes"
|
| 1517 |
+
},
|
| 1518 |
"POST /data-integrations/{slug}/credentials": {
|
| 1519 |
"sdkMethod": "createDataIntegrationCredential",
|
| 1520 |
"service": "pipes"
|
php/lib/Resource/AgentRegistrationRefreshed.php|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
declare(strict_types=1);
|
| 4 |
+
|
| 5 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 6 |
+
|
| 7 |
+
namespace WorkOS\Resource;
|
| 8 |
+
|
| 9 |
+
readonly class AgentRegistrationRefreshed implements \JsonSerializable
|
| 10 |
+
{
|
| 11 |
+
use JsonSerializableTrait;
|
| 12 |
+
|
| 13 |
+
public function __construct(
|
| 14 |
+
/** Distinguishes the Event object. */
|
| 15 |
+
public string $object,
|
| 16 |
+
/** Unique identifier for the event. */
|
| 17 |
+
public string $id,
|
| 18 |
+
public string $event,
|
| 19 |
+
/** The event payload. */
|
| 20 |
+
public AgentRegistrationRefreshedData $data,
|
| 21 |
+
/** An ISO 8601 timestamp. */
|
| 22 |
+
public \DateTimeImmutable $createdAt,
|
| 23 |
+
public ?EventContext $context = null,
|
| 24 |
+
) {
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public static function fromArray(array $data): self
|
| 28 |
+
{
|
| 29 |
+
return new self(
|
| 30 |
+
object: $data['object'] ?? 'event',
|
| 31 |
+
id: $data['id'],
|
| 32 |
+
event: $data['event'] ?? 'agent.registration.refreshed',
|
| 33 |
+
data: AgentRegistrationRefreshedData::fromArray($data['data']),
|
| 34 |
+
createdAt: new \DateTimeImmutable($data['created_at']),
|
| 35 |
+
context: isset($data['context']) ? EventContext::fromArray($data['context']) : null,
|
| 36 |
+
);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function toArray(): array
|
| 40 |
+
{
|
| 41 |
+
return [
|
| 42 |
+
'object' => $this->object,
|
| 43 |
+
'id' => $this->id,
|
| 44 |
+
'event' => $this->event,
|
| 45 |
+
'data' => $this->data->toArray(),
|
| 46 |
+
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 47 |
+
'context' => $this->context?->toArray(),
|
| 48 |
+
];
|
| 49 |
+
}
|
| 50 |
+
}
|
php/lib/Resource/AgentRegistrationRefreshedData.php|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
declare(strict_types=1);
|
| 4 |
+
|
| 5 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 6 |
+
|
| 7 |
+
namespace WorkOS\Resource;
|
| 8 |
+
|
| 9 |
+
/** The event payload. */
|
| 10 |
+
readonly class AgentRegistrationRefreshedData implements \JsonSerializable
|
| 11 |
+
{
|
| 12 |
+
use JsonSerializableTrait;
|
| 13 |
+
|
| 14 |
+
public function __construct(
|
| 15 |
+
/** The agent registration whose identity assertion was refreshed. */
|
| 16 |
+
public string $agentRegistrationId,
|
| 17 |
+
) {
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public static function fromArray(array $data): self
|
| 21 |
+
{
|
| 22 |
+
return new self(
|
| 23 |
+
agentRegistrationId: $data['agent_registration_id'],
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function toArray(): array
|
| 28 |
+
{
|
| 29 |
+
return [
|
| 30 |
+
'agent_registration_id' => $this->agentRegistrationId,
|
| 31 |
+
];
|
| 32 |
+
}
|
| 33 |
+
}
|
php/lib/Resource/AuthenticateResponseAuthenticationMethod.php|
@@ -19,6 +19,8 @@ enum AuthenticateResponseAuthenticationMethod: string
|
|
| 19 |
case GitHubOAuth = 'GitHubOAuth';
|
| 20 |
case GitLabOAuth = 'GitLabOAuth';
|
| 21 |
case GoogleOAuth = 'GoogleOAuth';
|
|
|
|
|
|
|
| 22 |
case IntuitOAuth = 'IntuitOAuth';
|
| 23 |
case LinkedInOAuth = 'LinkedInOAuth';
|
| 24 |
case MicrosoftOAuth = 'MicrosoftOAuth';
|
|
|
|
| 19 |
case GitHubOAuth = 'GitHubOAuth';
|
| 20 |
case GitLabOAuth = 'GitLabOAuth';
|
| 21 |
case GoogleOAuth = 'GoogleOAuth';
|
| 22 |
+
case GrokOAuth = 'GrokOAuth';
|
| 23 |
+
case XoAuth = 'XOAuth';
|
| 24 |
case IntuitOAuth = 'IntuitOAuth';
|
| 25 |
case LinkedInOAuth = 'LinkedInOAuth';
|
| 26 |
case MicrosoftOAuth = 'MicrosoftOAuth';
|
php/lib/Resource/ConnectedAccount.php|
@@ -39,6 +39,15 @@ readonly class ConnectedAccount implements \JsonSerializable
|
|
| 39 |
public ?DataIntegrationAuthMethods $authMethod = null,
|
| 40 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 41 |
public ?string $apiKeyLast4 = null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
) {
|
| 43 |
}
|
| 44 |
|
|
@@ -55,6 +64,9 @@ readonly class ConnectedAccount implements \JsonSerializable
|
|
| 55 |
updatedAt: $data['updated_at'],
|
| 56 |
authMethod: isset($data['auth_method']) ? DataIntegrationAuthMethods::from($data['auth_method']) : null,
|
| 57 |
apiKeyLast4: $data['api_key_last_4'] ?? null,
|
|
|
|
|
|
|
|
|
|
| 58 |
);
|
| 59 |
}
|
| 60 |
|
|
@@ -71,6 +83,9 @@ readonly class ConnectedAccount implements \JsonSerializable
|
|
| 71 |
'updated_at' => $this->updatedAt,
|
| 72 |
'auth_method' => $this->authMethod?->value,
|
| 73 |
'api_key_last_4' => $this->apiKeyLast4,
|
|
|
|
|
|
|
|
|
|
| 74 |
];
|
| 75 |
}
|
| 76 |
}
|
|
|
|
| 39 |
public ?DataIntegrationAuthMethods $authMethod = null,
|
| 40 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 41 |
public ?string $apiKeyLast4 = null,
|
| 42 |
+
/** The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`. */
|
| 43 |
+
public ?string $clientId = null,
|
| 44 |
+
/** The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`. */
|
| 45 |
+
public ?string $clientSecretLast4 = null,
|
| 46 |
+
/**
|
| 47 |
+
* The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 48 |
+
* @var array<string, string>|null
|
| 49 |
+
*/
|
| 50 |
+
public ?array $config = null,
|
| 51 |
) {
|
| 52 |
}
|
| 53 |
|
|
|
|
| 64 |
updatedAt: $data['updated_at'],
|
| 65 |
authMethod: isset($data['auth_method']) ? DataIntegrationAuthMethods::from($data['auth_method']) : null,
|
| 66 |
apiKeyLast4: $data['api_key_last_4'] ?? null,
|
| 67 |
+
clientId: $data['client_id'] ?? null,
|
| 68 |
+
clientSecretLast4: $data['client_secret_last_4'] ?? null,
|
| 69 |
+
config: $data['config'] ?? null,
|
| 70 |
);
|
| 71 |
}
|
| 72 |
|
|
|
|
| 83 |
'updated_at' => $this->updatedAt,
|
| 84 |
'auth_method' => $this->authMethod?->value,
|
| 85 |
'api_key_last_4' => $this->apiKeyLast4,
|
| 86 |
+
'client_id' => $this->clientId,
|
| 87 |
+
'client_secret_last_4' => $this->clientSecretLast4,
|
| 88 |
+
'config' => $this->config,
|
| 89 |
];
|
| 90 |
}
|
| 91 |
}
|
php/lib/Resource/ConnectionDeletedDataConnectionType.php|
@@ -30,6 +30,8 @@ enum ConnectionDeletedDataConnectionType: string
|
|
| 30 |
case GoogleOAuth = 'GoogleOAuth';
|
| 31 |
case GoogleOidc = 'GoogleOIDC';
|
| 32 |
case GoogleSAML = 'GoogleSAML';
|
|
|
|
|
|
|
| 33 |
case IntuitOAuth = 'IntuitOAuth';
|
| 34 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 35 |
case KeycloakSAML = 'KeycloakSAML';
|
|
|
|
| 30 |
case GoogleOAuth = 'GoogleOAuth';
|
| 31 |
case GoogleOidc = 'GoogleOIDC';
|
| 32 |
case GoogleSAML = 'GoogleSAML';
|
| 33 |
+
case GrokOAuth = 'GrokOAuth';
|
| 34 |
+
case XoAuth = 'XOAuth';
|
| 35 |
case IntuitOAuth = 'IntuitOAuth';
|
| 36 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 37 |
case KeycloakSAML = 'KeycloakSAML';
|
php/lib/Resource/ConnectionType.php|
@@ -31,6 +31,8 @@ enum ConnectionType: string
|
|
| 31 |
case GoogleOAuth = 'GoogleOAuth';
|
| 32 |
case GoogleOidc = 'GoogleOIDC';
|
| 33 |
case GoogleSAML = 'GoogleSAML';
|
|
|
|
|
|
|
| 34 |
case IntuitOAuth = 'IntuitOAuth';
|
| 35 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 36 |
case KeycloakSAML = 'KeycloakSAML';
|
|
|
|
| 31 |
case GoogleOAuth = 'GoogleOAuth';
|
| 32 |
case GoogleOidc = 'GoogleOIDC';
|
| 33 |
case GoogleSAML = 'GoogleSAML';
|
| 34 |
+
case GrokOAuth = 'GrokOAuth';
|
| 35 |
+
case XoAuth = 'XOAuth';
|
| 36 |
case IntuitOAuth = 'IntuitOAuth';
|
| 37 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 38 |
case KeycloakSAML = 'KeycloakSAML';
|
php/lib/Resource/ConnectionsConnectionType.php|
@@ -29,6 +29,8 @@ enum ConnectionsConnectionType: string
|
|
| 29 |
case GoogleOAuth = 'GoogleOAuth';
|
| 30 |
case GoogleOidc = 'GoogleOIDC';
|
| 31 |
case GoogleSAML = 'GoogleSAML';
|
|
|
|
|
|
|
| 32 |
case IntuitOAuth = 'IntuitOAuth';
|
| 33 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 34 |
case KeycloakSAML = 'KeycloakSAML';
|
|
|
|
| 29 |
case GoogleOAuth = 'GoogleOAuth';
|
| 30 |
case GoogleOidc = 'GoogleOIDC';
|
| 31 |
case GoogleSAML = 'GoogleSAML';
|
| 32 |
+
case GrokOAuth = 'GrokOAuth';
|
| 33 |
+
case XoAuth = 'XOAuth';
|
| 34 |
case IntuitOAuth = 'IntuitOAuth';
|
| 35 |
case JumpCloudSAML = 'JumpCloudSAML';
|
| 36 |
case KeycloakSAML = 'KeycloakSAML';
|
php/lib/Resource/CreateDataIntegration.php|
@@ -23,8 +23,8 @@ readonly class CreateDataIntegration implements \JsonSerializable
|
|
| 23 |
*/
|
| 24 |
public ?array $scopes = null,
|
| 25 |
/**
|
| 26 |
-
* How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 27 |
-
* @var array<\WorkOS\Resource\
|
| 28 |
*/
|
| 29 |
public ?array $authMethods = null,
|
| 30 |
/**
|
|
@@ -48,7 +48,7 @@ readonly class CreateDataIntegration implements \JsonSerializable
|
|
| 48 |
description: $data['description'] ?? null,
|
| 49 |
enabled: $data['enabled'] ?? null,
|
| 50 |
scopes: $data['scopes'] ?? null,
|
| 51 |
-
authMethods: isset($data['auth_methods']) ? array_map(fn ($item) =>
|
| 52 |
config: $data['config'] ?? null,
|
| 53 |
credentials: isset($data['credentials']) ? DataIntegrationCredentialsInput::fromArray($data['credentials']) : null,
|
| 54 |
apiKey: isset($data['api_key']) ? ApiKeyInstallation::fromArray($data['api_key']) : null,
|
|
|
|
| 23 |
*/
|
| 24 |
public ?array $scopes = null,
|
| 25 |
/**
|
| 26 |
+
* How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 27 |
+
* @var array<\WorkOS\Resource\DataIntegrationAuthMethods>|null
|
| 28 |
*/
|
| 29 |
public ?array $authMethods = null,
|
| 30 |
/**
|
|
|
|
| 48 |
description: $data['description'] ?? null,
|
| 49 |
enabled: $data['enabled'] ?? null,
|
| 50 |
scopes: $data['scopes'] ?? null,
|
| 51 |
+
authMethods: isset($data['auth_methods']) ? array_map(fn ($item) => DataIntegrationAuthMethods::from($item), $data['auth_methods']) : null,
|
| 52 |
config: $data['config'] ?? null,
|
| 53 |
credentials: isset($data['credentials']) ? DataIntegrationCredentialsInput::fromArray($data['credentials']) : null,
|
| 54 |
apiKey: isset($data['api_key']) ? ApiKeyInstallation::fromArray($data['api_key']) : null,
|
php/lib/Resource/CreateDataIntegrationAuthMethods.php|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
declare(strict_types=1);
|
| 4 |
-
|
| 5 |
-
// This file is auto-generated by oagen. Do not edit.
|
| 6 |
-
|
| 7 |
-
namespace WorkOS\Resource;
|
| 8 |
-
|
| 9 |
-
enum CreateDataIntegrationAuthMethods: string
|
| 10 |
-
{
|
| 11 |
-
case OAuth = 'oauth';
|
| 12 |
-
case ApiKey = 'api_key';
|
| 13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
php/lib/Resource/CreateWebhookEndpointEvents.php|
@@ -13,6 +13,7 @@ enum CreateWebhookEndpointEvents: string
|
|
| 13 |
case AgentRegistrationClaimCompleted = 'agent.registration.claim.completed';
|
| 14 |
case AgentRegistrationCredentialIssued = 'agent.registration.credential.issued';
|
| 15 |
case AgentRegistrationDeleted = 'agent.registration.deleted';
|
|
|
|
| 16 |
case AgentRegistrationExpired = 'agent.registration.expired';
|
| 17 |
case AgentRegistrationOrganizationSwitched = 'agent.registration.organization.switched';
|
| 18 |
case AgentRegistrationRevoked = 'agent.registration.revoked';
|
|
|
|
| 13 |
case AgentRegistrationClaimCompleted = 'agent.registration.claim.completed';
|
| 14 |
case AgentRegistrationCredentialIssued = 'agent.registration.credential.issued';
|
| 15 |
case AgentRegistrationDeleted = 'agent.registration.deleted';
|
| 16 |
+
case AgentRegistrationRefreshed = 'agent.registration.refreshed';
|
| 17 |
case AgentRegistrationExpired = 'agent.registration.expired';
|
| 18 |
case AgentRegistrationOrganizationSwitched = 'agent.registration.organization.switched';
|
| 19 |
case AgentRegistrationRevoked = 'agent.registration.revoked';
|
php/lib/Resource/CustomProviderDefinition.php|
@@ -13,10 +13,10 @@ readonly class CustomProviderDefinition implements \JsonSerializable
|
|
| 13 |
public function __construct(
|
| 14 |
/** A descriptive name for the custom provider. */
|
| 15 |
public string $name,
|
| 16 |
-
/** The provider's OAuth authorization endpoint. */
|
| 17 |
-
public string $authorizationUrl,
|
| 18 |
-
/** The provider's OAuth token endpoint. */
|
| 19 |
-
public string $tokenUrl,
|
| 20 |
/** The endpoint used to refresh tokens, if different from the token endpoint. */
|
| 21 |
public ?string $refreshTokenUrl = null,
|
| 22 |
/** Whether PKCE is used during the authorization code flow. Defaults to `true`. */
|
|
@@ -43,8 +43,8 @@ readonly class CustomProviderDefinition implements \JsonSerializable
|
|
| 43 |
{
|
| 44 |
return new self(
|
| 45 |
name: $data['name'],
|
| 46 |
-
authorizationUrl: $data['authorization_url'],
|
| 47 |
-
tokenUrl: $data['token_url'],
|
| 48 |
refreshTokenUrl: $data['refresh_token_url'] ?? null,
|
| 49 |
pkceEnabled: $data['pkce_enabled'] ?? null,
|
| 50 |
requestScopeSeparator: $data['request_scope_separator'] ?? null,
|
|
|
|
| 13 |
public function __construct(
|
| 14 |
/** A descriptive name for the custom provider. */
|
| 15 |
public string $name,
|
| 16 |
+
/** The provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers. */
|
| 17 |
+
public ?string $authorizationUrl = null,
|
| 18 |
+
/** The provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers. */
|
| 19 |
+
public ?string $tokenUrl = null,
|
| 20 |
/** The endpoint used to refresh tokens, if different from the token endpoint. */
|
| 21 |
public ?string $refreshTokenUrl = null,
|
| 22 |
/** Whether PKCE is used during the authorization code flow. Defaults to `true`. */
|
|
|
|
| 43 |
{
|
| 44 |
return new self(
|
| 45 |
name: $data['name'],
|
| 46 |
+
authorizationUrl: $data['authorization_url'] ?? null,
|
| 47 |
+
tokenUrl: $data['token_url'] ?? null,
|
| 48 |
refreshTokenUrl: $data['refresh_token_url'] ?? null,
|
| 49 |
pkceEnabled: $data['pkce_enabled'] ?? null,
|
| 50 |
requestScopeSeparator: $data['request_scope_separator'] ?? null,
|
php/lib/Resource/DataIntegration.php|
@@ -37,8 +37,8 @@ readonly class DataIntegration implements \JsonSerializable
|
|
| 37 |
* @var array<\WorkOS\Resource\DataIntegrationAuthMethods>
|
| 38 |
*/
|
| 39 |
public array $authMethods,
|
| 40 |
-
/** The credentials
|
| 41 |
-
public DataIntegrationCredential $credentials,
|
| 42 |
/** The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses. */
|
| 43 |
public ?DataIntegrationInstallation $installation,
|
| 44 |
/**
|
|
@@ -68,7 +68,7 @@ readonly class DataIntegration implements \JsonSerializable
|
|
| 68 |
scopes: $data['scopes'] ?? null,
|
| 69 |
redirectUri: $data['redirect_uri'],
|
| 70 |
authMethods: array_map(fn ($item) => DataIntegrationAuthMethods::from($item), $data['auth_methods']),
|
| 71 |
-
credentials: DataIntegrationCredential::fromArray($data['credentials']),
|
| 72 |
installation: isset($data['installation']) ? DataIntegrationInstallation::fromArray($data['installation']) : null,
|
| 73 |
config: $data['config'],
|
| 74 |
customProvider: isset($data['custom_provider']) ? DataIntegrationCustomProvider::fromArray($data['custom_provider']) : null,
|
|
@@ -90,7 +90,7 @@ readonly class DataIntegration implements \JsonSerializable
|
|
| 90 |
'scopes' => $this->scopes,
|
| 91 |
'redirect_uri' => $this->redirectUri,
|
| 92 |
'auth_methods' => array_map(fn ($item) => $item->value, $this->authMethods),
|
| 93 |
-
'credentials' => $this->credentials->toArray(),
|
| 94 |
'installation' => $this->installation?->toArray(),
|
| 95 |
'config' => $this->config,
|
| 96 |
'custom_provider' => $this->customProvider?->toArray(),
|
|
|
|
| 37 |
* @var array<\WorkOS\Resource\DataIntegrationAuthMethods>
|
| 38 |
*/
|
| 39 |
public array $authMethods,
|
| 40 |
+
/** The integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant). */
|
| 41 |
+
public ?DataIntegrationCredential $credentials,
|
| 42 |
/** The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses. */
|
| 43 |
public ?DataIntegrationInstallation $installation,
|
| 44 |
/**
|
|
|
|
| 68 |
scopes: $data['scopes'] ?? null,
|
| 69 |
redirectUri: $data['redirect_uri'],
|
| 70 |
authMethods: array_map(fn ($item) => DataIntegrationAuthMethods::from($item), $data['auth_methods']),
|
| 71 |
+
credentials: isset($data['credentials']) ? DataIntegrationCredential::fromArray($data['credentials']) : null,
|
| 72 |
installation: isset($data['installation']) ? DataIntegrationInstallation::fromArray($data['installation']) : null,
|
| 73 |
config: $data['config'],
|
| 74 |
customProvider: isset($data['custom_provider']) ? DataIntegrationCustomProvider::fromArray($data['custom_provider']) : null,
|
|
|
|
| 90 |
'scopes' => $this->scopes,
|
| 91 |
'redirect_uri' => $this->redirectUri,
|
| 92 |
'auth_methods' => array_map(fn ($item) => $item->value, $this->authMethods),
|
| 93 |
+
'credentials' => $this->credentials?->toArray(),
|
| 94 |
'installation' => $this->installation?->toArray(),
|
| 95 |
'config' => $this->config,
|
| 96 |
'custom_provider' => $this->customProvider?->toArray(),
|
php/lib/Resource/DataIntegrationCredential.php|
@@ -6,7 +6,6 @@ declare(strict_types=1);
|
|
| 6 |
|
| 7 |
namespace WorkOS\Resource;
|
| 8 |
|
| 9 |
-
/** The credentials configured for the Data Integration. */
|
| 10 |
readonly class DataIntegrationCredential implements \JsonSerializable
|
| 11 |
{
|
| 12 |
use JsonSerializableTrait;
|
|
|
|
| 6 |
|
| 7 |
namespace WorkOS\Resource;
|
| 8 |
|
|
|
|
| 9 |
readonly class DataIntegrationCredential implements \JsonSerializable
|
| 10 |
{
|
| 11 |
use JsonSerializableTrait;
|
php/lib/Resource/DataIntegrationsListResponseDataConnectedAccount.php|
@@ -44,6 +44,15 @@ readonly class DataIntegrationsListResponseDataConnectedAccount implements \Json
|
|
| 44 |
public ?DataIntegrationAuthMethods $authMethod = null,
|
| 45 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 46 |
public ?string $apiKeyLast4 = null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
) {
|
| 48 |
}
|
| 49 |
|
|
@@ -61,6 +70,9 @@ readonly class DataIntegrationsListResponseDataConnectedAccount implements \Json
|
|
| 61 |
userlandUserId: $data['userlandUserId'] ?? null,
|
| 62 |
authMethod: isset($data['auth_method']) ? DataIntegrationAuthMethods::from($data['auth_method']) : null,
|
| 63 |
apiKeyLast4: $data['api_key_last_4'] ?? null,
|
|
|
|
|
|
|
|
|
|
| 64 |
);
|
| 65 |
}
|
| 66 |
|
|
@@ -78,6 +90,9 @@ readonly class DataIntegrationsListResponseDataConnectedAccount implements \Json
|
|
| 78 |
'userlandUserId' => $this->userlandUserId,
|
| 79 |
'auth_method' => $this->authMethod?->value,
|
| 80 |
'api_key_last_4' => $this->apiKeyLast4,
|
|
|
|
|
|
|
|
|
|
| 81 |
];
|
| 82 |
}
|
| 83 |
}
|
|
|
|
| 44 |
public ?DataIntegrationAuthMethods $authMethod = null,
|
| 45 |
/** The last four characters of the API key, or `null` for OAuth connections. */
|
| 46 |
public ?string $apiKeyLast4 = null,
|
| 47 |
+
/** The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`. */
|
| 48 |
+
public ?string $clientId = null,
|
| 49 |
+
/** The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`. */
|
| 50 |
+
public ?string $clientSecretLast4 = null,
|
| 51 |
+
/**
|
| 52 |
+
* The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 53 |
+
* @var array<string, string>|null
|
| 54 |
+
*/
|
| 55 |
+
public ?array $config = null,
|
| 56 |
) {
|
| 57 |
}
|
| 58 |
|
|
|
|
| 70 |
userlandUserId: $data['userlandUserId'] ?? null,
|
| 71 |
authMethod: isset($data['auth_method']) ? DataIntegrationAuthMethods::from($data['auth_method']) : null,
|
| 72 |
apiKeyLast4: $data['api_key_last_4'] ?? null,
|
| 73 |
+
clientId: $data['client_id'] ?? null,
|
| 74 |
+
clientSecretLast4: $data['client_secret_last_4'] ?? null,
|
| 75 |
+
config: $data['config'] ?? null,
|
| 76 |
);
|
| 77 |
}
|
| 78 |
|
|
|
|
| 90 |
'userlandUserId' => $this->userlandUserId,
|
| 91 |
'auth_method' => $this->authMethod?->value,
|
| 92 |
'api_key_last_4' => $this->apiKeyLast4,
|
| 93 |
+
'client_id' => $this->clientId,
|
| 94 |
+
'client_secret_last_4' => $this->clientSecretLast4,
|
| 95 |
+
'config' => $this->config,
|
| 96 |
];
|
| 97 |
}
|
| 98 |
}
|
php/lib/Resource/DataIntegrationsUpsertClientCredentialsRequest.php|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
declare(strict_types=1);
|
| 4 |
+
|
| 5 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 6 |
+
|
| 7 |
+
namespace WorkOS\Resource;
|
| 8 |
+
|
| 9 |
+
readonly class DataIntegrationsUpsertClientCredentialsRequest implements \JsonSerializable
|
| 10 |
+
{
|
| 11 |
+
use JsonSerializableTrait;
|
| 12 |
+
|
| 13 |
+
public function __construct(
|
| 14 |
+
/** A [User](https://workos.com/docs/reference/authkit/user) identifier. */
|
| 15 |
+
public string $userId,
|
| 16 |
+
/** The OAuth client ID to store for this integration. */
|
| 17 |
+
public string $clientId,
|
| 18 |
+
/** The OAuth client secret to store for this integration. */
|
| 19 |
+
public string $clientSecret,
|
| 20 |
+
/** An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. */
|
| 21 |
+
public ?string $organizationId = null,
|
| 22 |
+
/**
|
| 23 |
+
* Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 24 |
+
* @var array<string, string>|null
|
| 25 |
+
*/
|
| 26 |
+
public ?array $config = null,
|
| 27 |
+
) {
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public static function fromArray(array $data): self
|
| 31 |
+
{
|
| 32 |
+
return new self(
|
| 33 |
+
userId: $data['user_id'],
|
| 34 |
+
clientId: $data['client_id'],
|
| 35 |
+
clientSecret: $data['client_secret'],
|
| 36 |
+
organizationId: $data['organization_id'] ?? null,
|
| 37 |
+
config: $data['config'] ?? null,
|
| 38 |
+
);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
public function toArray(): array
|
| 42 |
+
{
|
| 43 |
+
return [
|
| 44 |
+
'user_id' => $this->userId,
|
| 45 |
+
'client_id' => $this->clientId,
|
| 46 |
+
'client_secret' => $this->clientSecret,
|
| 47 |
+
'organization_id' => $this->organizationId,
|
| 48 |
+
'config' => $this->config,
|
| 49 |
+
];
|
| 50 |
+
}
|
| 51 |
+
}
|
php/lib/Resource/RadarSmsChallengeCodeSessionAuthenticateRequest.php|
@@ -18,12 +18,12 @@ readonly class RadarSmsChallengeCodeSessionAuthenticateRequest implements \JsonS
|
|
| 18 |
public string $grantType,
|
| 19 |
/** The one-time code from the Radar SMS challenge. */
|
| 20 |
public string $code,
|
| 21 |
-
/** The ID of the Radar SMS verification being confirmed. */
|
| 22 |
-
public string $verificationId,
|
| 23 |
-
/** The phone number the Radar SMS challenge was sent to. */
|
| 24 |
-
public string $phoneNumber,
|
| 25 |
/** The pending authentication token from a previous authentication attempt. */
|
| 26 |
public string $pendingAuthenticationToken,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
/** The IP address of the user's request. */
|
| 28 |
public ?string $ipAddress = null,
|
| 29 |
/** A unique identifier for the device. */
|
|
@@ -40,9 +40,9 @@ readonly class RadarSmsChallengeCodeSessionAuthenticateRequest implements \JsonS
|
|
| 40 |
clientSecret: $data['client_secret'],
|
| 41 |
grantType: $data['grant_type'] ?? 'urn:workos:oauth:grant-type:radar-sms-challenge:code',
|
| 42 |
code: $data['code'],
|
| 43 |
-
verificationId: $data['verification_id'],
|
| 44 |
-
phoneNumber: $data['phone_number'],
|
| 45 |
pendingAuthenticationToken: $data['pending_authentication_token'],
|
|
|
|
|
|
|
| 46 |
ipAddress: $data['ip_address'] ?? null,
|
| 47 |
deviceId: $data['device_id'] ?? null,
|
| 48 |
userAgent: $data['user_agent'] ?? null,
|
|
@@ -56,9 +56,9 @@ readonly class RadarSmsChallengeCodeSessionAuthenticateRequest implements \JsonS
|
|
| 56 |
'client_secret' => $this->clientSecret,
|
| 57 |
'grant_type' => $this->grantType,
|
| 58 |
'code' => $this->code,
|
|
|
|
| 59 |
'verification_id' => $this->verificationId,
|
| 60 |
'phone_number' => $this->phoneNumber,
|
| 61 |
-
'pending_authentication_token' => $this->pendingAuthenticationToken,
|
| 62 |
'ip_address' => $this->ipAddress,
|
| 63 |
'device_id' => $this->deviceId,
|
| 64 |
'user_agent' => $this->userAgent,
|
|
|
|
| 18 |
public string $grantType,
|
| 19 |
/** The one-time code from the Radar SMS challenge. */
|
| 20 |
public string $code,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
/** The pending authentication token from a previous authentication attempt. */
|
| 22 |
public string $pendingAuthenticationToken,
|
| 23 |
+
/** The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side. */
|
| 24 |
+
public ?string $verificationId = null,
|
| 25 |
+
/** The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side. */
|
| 26 |
+
public ?string $phoneNumber = null,
|
| 27 |
/** The IP address of the user's request. */
|
| 28 |
public ?string $ipAddress = null,
|
| 29 |
/** A unique identifier for the device. */
|
|
|
|
| 40 |
clientSecret: $data['client_secret'],
|
| 41 |
grantType: $data['grant_type'] ?? 'urn:workos:oauth:grant-type:radar-sms-challenge:code',
|
| 42 |
code: $data['code'],
|
|
|
|
|
|
|
| 43 |
pendingAuthenticationToken: $data['pending_authentication_token'],
|
| 44 |
+
verificationId: $data['verification_id'] ?? null,
|
| 45 |
+
phoneNumber: $data['phone_number'] ?? null,
|
| 46 |
ipAddress: $data['ip_address'] ?? null,
|
| 47 |
deviceId: $data['device_id'] ?? null,
|
| 48 |
userAgent: $data['user_agent'] ?? null,
|
|
|
|
| 56 |
'client_secret' => $this->clientSecret,
|
| 57 |
'grant_type' => $this->grantType,
|
| 58 |
'code' => $this->code,
|
| 59 |
+
'pending_authentication_token' => $this->pendingAuthenticationToken,
|
| 60 |
'verification_id' => $this->verificationId,
|
| 61 |
'phone_number' => $this->phoneNumber,
|
|
|
|
| 62 |
'ip_address' => $this->ipAddress,
|
| 63 |
'device_id' => $this->deviceId,
|
| 64 |
'user_agent' => $this->userAgent,
|
php/lib/Resource/UserIdentitiesGetItemProvider.php|
@@ -14,6 +14,8 @@ enum UserIdentitiesGetItemProvider: string
|
|
| 14 |
case GithubOAuth = 'GithubOAuth';
|
| 15 |
case GitLabOAuth = 'GitLabOAuth';
|
| 16 |
case GoogleOAuth = 'GoogleOAuth';
|
|
|
|
|
|
|
| 17 |
case IntuitOAuth = 'IntuitOAuth';
|
| 18 |
case LinkedInOAuth = 'LinkedInOAuth';
|
| 19 |
case MicrosoftOAuth = 'MicrosoftOAuth';
|
|
|
|
| 14 |
case GithubOAuth = 'GithubOAuth';
|
| 15 |
case GitLabOAuth = 'GitLabOAuth';
|
| 16 |
case GoogleOAuth = 'GoogleOAuth';
|
| 17 |
+
case GrokOAuth = 'GrokOAuth';
|
| 18 |
+
case XoAuth = 'XOAuth';
|
| 19 |
case IntuitOAuth = 'IntuitOAuth';
|
| 20 |
case LinkedInOAuth = 'LinkedInOAuth';
|
| 21 |
case MicrosoftOAuth = 'MicrosoftOAuth';
|
php/lib/Resource/WaitlistUser.php|
@@ -25,6 +25,8 @@ readonly class WaitlistUser implements \JsonSerializable
|
|
| 25 |
public \DateTimeImmutable $createdAt,
|
| 26 |
/** An ISO 8601 timestamp. */
|
| 27 |
public \DateTimeImmutable $updatedAt,
|
|
|
|
|
|
|
| 28 |
) {
|
| 29 |
}
|
| 30 |
|
|
@@ -38,6 +40,7 @@ readonly class WaitlistUser implements \JsonSerializable
|
|
| 38 |
approvedAt: isset($data['approved_at']) ? new \DateTimeImmutable($data['approved_at']) : null,
|
| 39 |
createdAt: new \DateTimeImmutable($data['created_at']),
|
| 40 |
updatedAt: new \DateTimeImmutable($data['updated_at']),
|
|
|
|
| 41 |
);
|
| 42 |
}
|
| 43 |
|
|
@@ -51,6 +54,7 @@ readonly class WaitlistUser implements \JsonSerializable
|
|
| 51 |
'approved_at' => $this->approvedAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 52 |
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 53 |
'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED),
|
|
|
|
| 54 |
];
|
| 55 |
}
|
| 56 |
}
|
|
|
|
| 25 |
public \DateTimeImmutable $createdAt,
|
| 26 |
/** An ISO 8601 timestamp. */
|
| 27 |
public \DateTimeImmutable $updatedAt,
|
| 28 |
+
/** The unique ID of the Waitlist that the Waitlist User joined. */
|
| 29 |
+
public ?string $waitlistId = null,
|
| 30 |
) {
|
| 31 |
}
|
| 32 |
|
|
|
|
| 40 |
approvedAt: isset($data['approved_at']) ? new \DateTimeImmutable($data['approved_at']) : null,
|
| 41 |
createdAt: new \DateTimeImmutable($data['created_at']),
|
| 42 |
updatedAt: new \DateTimeImmutable($data['updated_at']),
|
| 43 |
+
waitlistId: $data['waitlist_id'] ?? null,
|
| 44 |
);
|
| 45 |
}
|
| 46 |
|
|
|
|
| 54 |
'approved_at' => $this->approvedAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 55 |
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 56 |
'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED),
|
| 57 |
+
'waitlist_id' => $this->waitlistId,
|
| 58 |
];
|
| 59 |
}
|
| 60 |
}
|
php/lib/Service/Pipes.php|
@@ -56,12 +56,12 @@ class Pipes
|
|
| 56 |
/**
|
| 57 |
* Create a data integration
|
| 58 |
*
|
| 59 |
-
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 60 |
* @param string $provider The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 61 |
* @param string|null $description An optional description of the Data Integration.
|
| 62 |
* @param bool|null $enabled Whether the Data Integration is enabled. Defaults to `false`.
|
| 63 |
* @param array<string>|null $scopes The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 64 |
-
* @param array<\WorkOS\Resource\
|
| 65 |
* @param array<string, string>|null $config Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 66 |
* @param \WorkOS\Resource\DataIntegrationCredentialsInput|null $credentials The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 67 |
* @param \WorkOS\Resource\ApiKeyInstallation|null $apiKey An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
@@ -248,6 +248,44 @@ class Pipes
|
|
| 248 |
return DataIntegrationAuthorizeUrlResponse::fromArray($response);
|
| 249 |
}
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
/**
|
| 252 |
* Vend credentials for a connected account
|
| 253 |
*
|
|
|
|
| 56 |
/**
|
| 57 |
* Create a data integration
|
| 58 |
*
|
| 59 |
+
* Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 60 |
* @param string $provider The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 61 |
* @param string|null $description An optional description of the Data Integration.
|
| 62 |
* @param bool|null $enabled Whether the Data Integration is enabled. Defaults to `false`.
|
| 63 |
* @param array<string>|null $scopes The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 64 |
+
* @param array<\WorkOS\Resource\DataIntegrationAuthMethods>|null $authMethods How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 65 |
* @param array<string, string>|null $config Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 66 |
* @param \WorkOS\Resource\DataIntegrationCredentialsInput|null $credentials The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 67 |
* @param \WorkOS\Resource\ApiKeyInstallation|null $apiKey An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
|
|
| 248 |
return DataIntegrationAuthorizeUrlResponse::fromArray($response);
|
| 249 |
}
|
| 250 |
|
| 251 |
+
/**
|
| 252 |
+
* Upsert client credentials for a connected account
|
| 253 |
+
*
|
| 254 |
+
* Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 255 |
+
* @param string $slug The identifier of the integration.
|
| 256 |
+
* @param string $userId A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 257 |
+
* @param string|null $organizationId An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 258 |
+
* @param string $clientId The OAuth client ID to store for this integration.
|
| 259 |
+
* @param string $clientSecret The OAuth client secret to store for this integration.
|
| 260 |
+
* @param array<string, string>|null $config Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 261 |
+
* @return \WorkOS\Resource\ConnectedAccount
|
| 262 |
+
* @throws \WorkOS\Exception\WorkOSException
|
| 263 |
+
*/
|
| 264 |
+
public function updateDataIntegrationClientCredentials(
|
| 265 |
+
string $slug,
|
| 266 |
+
string $userId,
|
| 267 |
+
string $clientId,
|
| 268 |
+
string $clientSecret,
|
| 269 |
+
?string $organizationId = null,
|
| 270 |
+
?array $config = null,
|
| 271 |
+
?\WorkOS\RequestOptions $options = null,
|
| 272 |
+
): \WorkOS\Resource\ConnectedAccount {
|
| 273 |
+
$body = array_filter([
|
| 274 |
+
'user_id' => $userId,
|
| 275 |
+
'organization_id' => $organizationId,
|
| 276 |
+
'client_id' => $clientId,
|
| 277 |
+
'client_secret' => $clientSecret,
|
| 278 |
+
'config' => $config,
|
| 279 |
+
], fn ($v) => $v !== null);
|
| 280 |
+
$response = $this->client->request(
|
| 281 |
+
method: 'PUT',
|
| 282 |
+
path: 'data-integrations/' . rawurlencode($slug) . '/client-credentials',
|
| 283 |
+
body: $body,
|
| 284 |
+
options: $options,
|
| 285 |
+
);
|
| 286 |
+
return ConnectedAccount::fromArray($response);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
/**
|
| 290 |
* Vend credentials for a connected account
|
| 291 |
*
|
php/lib/Service/UserManagement.php|
@@ -418,8 +418,8 @@ class UserManagement
|
|
| 418 |
|
| 419 |
/**
|
| 420 |
* @param string $code
|
| 421 |
-
* @param string $verificationId
|
| 422 |
-
* @param string $phoneNumber
|
| 423 |
* @param string $pendingAuthenticationToken
|
| 424 |
* @param string|null $ipAddress
|
| 425 |
* @param string|null $deviceId
|
|
@@ -429,9 +429,9 @@ class UserManagement
|
|
| 429 |
*/
|
| 430 |
public function authenticateWithRadarSmsChallenge(
|
| 431 |
string $code,
|
| 432 |
-
string $verificationId,
|
| 433 |
-
string $phoneNumber,
|
| 434 |
string $pendingAuthenticationToken,
|
|
|
|
|
|
|
| 435 |
?string $ipAddress = null,
|
| 436 |
?string $deviceId = null,
|
| 437 |
?string $userAgent = null,
|
|
|
|
| 418 |
|
| 419 |
/**
|
| 420 |
* @param string $code
|
| 421 |
+
* @param string|null $verificationId
|
| 422 |
+
* @param string|null $phoneNumber
|
| 423 |
* @param string $pendingAuthenticationToken
|
| 424 |
* @param string|null $ipAddress
|
| 425 |
* @param string|null $deviceId
|
|
|
|
| 429 |
*/
|
| 430 |
public function authenticateWithRadarSmsChallenge(
|
| 431 |
string $code,
|
|
|
|
|
|
|
| 432 |
string $pendingAuthenticationToken,
|
| 433 |
+
?string $verificationId = null,
|
| 434 |
+
?string $phoneNumber = null,
|
| 435 |
?string $ipAddress = null,
|
| 436 |
?string $deviceId = null,
|
| 437 |
?string $userAgent = null,
|
php/tests/Fixtures/agent_registration_refreshed.json|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
+
"context": {
|
| 10 |
+
"google_analytics_client_id": "GA1.2.1234567890.1234567890",
|
| 11 |
+
"google_analytics_sessions": [
|
| 12 |
+
{
|
| 13 |
+
"containerId": "GTM-ABCDEF",
|
| 14 |
+
"sessionId": "1234567890",
|
| 15 |
+
"sessionNumber": "1"
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 19 |
+
"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 20 |
+
"actor": {
|
| 21 |
+
"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 22 |
+
"source": "api",
|
| 23 |
+
"name": "Jane Doe"
|
| 24 |
+
},
|
| 25 |
+
"previous_attributes": {
|
| 26 |
+
"key": {}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
php/tests/Fixtures/agent_registration_refreshed_data.json|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 3 |
+
}
|
php/tests/Fixtures/connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
php/tests/Fixtures/data_integrations_list_response.json|
@@ -34,6 +34,11 @@
|
|
| 34 |
],
|
| 35 |
"auth_method": "oauth",
|
| 36 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
"state": "connected",
|
| 38 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 39 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 34 |
],
|
| 35 |
"auth_method": "oauth",
|
| 36 |
"api_key_last_4": null,
|
| 37 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 38 |
+
"client_secret_last_4": "cdef",
|
| 39 |
+
"config": {
|
| 40 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 41 |
+
},
|
| 42 |
"state": "connected",
|
| 43 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 44 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
php/tests/Fixtures/data_integrations_list_response_data.json|
@@ -31,6 +31,11 @@
|
|
| 31 |
],
|
| 32 |
"auth_method": "oauth",
|
| 33 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
"state": "connected",
|
| 35 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 36 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 31 |
],
|
| 32 |
"auth_method": "oauth",
|
| 33 |
"api_key_last_4": null,
|
| 34 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 35 |
+
"client_secret_last_4": "cdef",
|
| 36 |
+
"config": {
|
| 37 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 38 |
+
},
|
| 39 |
"state": "connected",
|
| 40 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 41 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
php/tests/Fixtures/data_integrations_list_response_data_connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
php/tests/Fixtures/data_integrations_upsert_client_credentials_request.json|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"client_id": "3MVG9...",
|
| 5 |
+
"client_secret": "shhh-secret",
|
| 6 |
+
"config": {
|
| 7 |
+
"mydomain": "acme"
|
| 8 |
+
}
|
| 9 |
+
}
|
php/tests/Fixtures/waitlist_user.json|
@@ -4,6 +4,7 @@
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
|
|
|
| 7 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 8 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
}
|
|
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
| 7 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 8 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 10 |
}
|
php/tests/Fixtures/waitlist_user_approved.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
php/tests/Fixtures/waitlist_user_created.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
php/tests/Fixtures/waitlist_user_denied.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
php/tests/Service/PipesTest.php|
@@ -114,6 +114,24 @@ class PipesTest extends TestCase
|
|
| 114 |
$this->assertSame('test_value', $body['user_id']);
|
| 115 |
}
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
public function testCreateDataIntegrationCredential(): void
|
| 118 |
{
|
| 119 |
$fixture = $this->loadFixture('data_integration_credentials_response');
|
|
|
|
| 114 |
$this->assertSame('test_value', $body['user_id']);
|
| 115 |
}
|
| 116 |
|
| 117 |
+
public function testUpdateDataIntegrationClientCredentials(): void
|
| 118 |
+
{
|
| 119 |
+
$fixture = $this->loadFixture('connected_account');
|
| 120 |
+
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
|
| 121 |
+
$result = $client->pipes()->updateDataIntegrationClientCredentials('test_slug', userId: 'test_value', clientId: 'test_value', clientSecret: 'test_value');
|
| 122 |
+
$this->assertInstanceOf(\WorkOS\Resource\ConnectedAccount::class, $result);
|
| 123 |
+
$this->assertSame($fixture['id'], $result->id);
|
| 124 |
+
$this->assertSame($fixture['created_at'], $result->createdAt);
|
| 125 |
+
$this->assertIsArray($result->toArray());
|
| 126 |
+
$request = $this->getLastRequest();
|
| 127 |
+
$this->assertSame('PUT', $request->getMethod());
|
| 128 |
+
$this->assertStringEndsWith('data-integrations/test_slug/client-credentials', $request->getUri()->getPath());
|
| 129 |
+
$body = json_decode((string) $request->getBody(), true);
|
| 130 |
+
$this->assertSame('test_value', $body['user_id']);
|
| 131 |
+
$this->assertSame('test_value', $body['client_id']);
|
| 132 |
+
$this->assertSame('test_value', $body['client_secret']);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
public function testCreateDataIntegrationCredential(): void
|
| 136 |
{
|
| 137 |
$fixture = $this->loadFixture('data_integration_credentials_response');
|
php/tests/Service/UserManagementTest.php|
@@ -714,7 +714,7 @@ class UserManagementTest extends TestCase
|
|
| 714 |
{
|
| 715 |
$fixture = $this->loadFixture('authenticate_response');
|
| 716 |
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
|
| 717 |
-
$result = $client->userManagement()->authenticateWithRadarSmsChallenge(code: 'test_value',
|
| 718 |
$this->assertInstanceOf(\WorkOS\Resource\AuthenticateResponse::class, $result);
|
| 719 |
}
|
|
|
|
| 714 |
{
|
| 715 |
$fixture = $this->loadFixture('authenticate_response');
|
| 716 |
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
|
| 717 |
+
$result = $client->userManagement()->authenticateWithRadarSmsChallenge(code: 'test_value', pendingAuthenticationToken: 'test_value');
|
| 718 |
$this->assertInstanceOf(\WorkOS\Resource\AuthenticateResponse::class, $result);
|
| 719 |
}
|
All files in this language are hidden by the current filters.
code: 444 ยท tests: 51 ยท manifest: 1
python/.oagen-manifest.json|
@@ -119,6 +119,8 @@
|
|
| 119 |
"src/workos/common/models/agent_registration_kind.py",
|
| 120 |
"src/workos/common/models/agent_registration_organization_switched.py",
|
| 121 |
"src/workos/common/models/agent_registration_organization_switched_data.py",
|
|
|
|
|
|
|
| 122 |
"src/workos/common/models/agent_registration_revoked.py",
|
| 123 |
"src/workos/common/models/agent_registration_revoked_data.py",
|
| 124 |
"src/workos/common/models/agent_registration_status.py",
|
|
@@ -620,6 +622,7 @@
|
|
| 620 |
"src/workos/pipes/models/data_integrations_list_response_data.py",
|
| 621 |
"src/workos/pipes/models/data_integrations_list_response_data_connected_account.py",
|
| 622 |
"src/workos/pipes/models/data_integrations_upsert_api_key_request.py",
|
|
|
|
| 623 |
"src/workos/pipes/models/data_integrations_vend_credentials_request.py",
|
| 624 |
"src/workos/pipes/models/update_custom_provider_definition.py",
|
| 625 |
"src/workos/pipes/models/update_data_integration.py",
|
|
@@ -801,6 +804,8 @@
|
|
| 801 |
"tests/fixtures/agent_registration_expired_data.json",
|
| 802 |
"tests/fixtures/agent_registration_organization_switched.json",
|
| 803 |
"tests/fixtures/agent_registration_organization_switched_data.json",
|
|
|
|
|
|
|
| 804 |
"tests/fixtures/agent_registration_revoked.json",
|
| 805 |
"tests/fixtures/agent_registration_revoked_data.json",
|
| 806 |
"tests/fixtures/api_key.json",
|
|
@@ -982,6 +987,7 @@
|
|
| 982 |
"tests/fixtures/data_integrations_list_response_data.json",
|
| 983 |
"tests/fixtures/data_integrations_list_response_data_connected_account.json",
|
| 984 |
"tests/fixtures/data_integrations_upsert_api_key_request.json",
|
|
|
|
| 985 |
"tests/fixtures/data_integrations_vend_credentials_request.json",
|
| 986 |
"tests/fixtures/decrypt_request.json",
|
| 987 |
"tests/fixtures/decrypt_response.json",
|
|
@@ -1666,6 +1672,10 @@
|
|
| 1666 |
"sdkMethod": "authorize_data_integration",
|
| 1667 |
"service": "pipes"
|
| 1668 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1669 |
"POST /data-integrations/{slug}/credentials": {
|
| 1670 |
"sdkMethod": "create_data_integration_credential",
|
| 1671 |
"service": "pipes"
|
|
|
|
| 119 |
"src/workos/common/models/agent_registration_kind.py",
|
| 120 |
"src/workos/common/models/agent_registration_organization_switched.py",
|
| 121 |
"src/workos/common/models/agent_registration_organization_switched_data.py",
|
| 122 |
+
"src/workos/common/models/agent_registration_refreshed.py",
|
| 123 |
+
"src/workos/common/models/agent_registration_refreshed_data.py",
|
| 124 |
"src/workos/common/models/agent_registration_revoked.py",
|
| 125 |
"src/workos/common/models/agent_registration_revoked_data.py",
|
| 126 |
"src/workos/common/models/agent_registration_status.py",
|
|
|
|
| 622 |
"src/workos/pipes/models/data_integrations_list_response_data.py",
|
| 623 |
"src/workos/pipes/models/data_integrations_list_response_data_connected_account.py",
|
| 624 |
"src/workos/pipes/models/data_integrations_upsert_api_key_request.py",
|
| 625 |
+
"src/workos/pipes/models/data_integrations_upsert_client_credentials_request.py",
|
| 626 |
"src/workos/pipes/models/data_integrations_vend_credentials_request.py",
|
| 627 |
"src/workos/pipes/models/update_custom_provider_definition.py",
|
| 628 |
"src/workos/pipes/models/update_data_integration.py",
|
|
|
|
| 804 |
"tests/fixtures/agent_registration_expired_data.json",
|
| 805 |
"tests/fixtures/agent_registration_organization_switched.json",
|
| 806 |
"tests/fixtures/agent_registration_organization_switched_data.json",
|
| 807 |
+
"tests/fixtures/agent_registration_refreshed.json",
|
| 808 |
+
"tests/fixtures/agent_registration_refreshed_data.json",
|
| 809 |
"tests/fixtures/agent_registration_revoked.json",
|
| 810 |
"tests/fixtures/agent_registration_revoked_data.json",
|
| 811 |
"tests/fixtures/api_key.json",
|
|
|
|
| 987 |
"tests/fixtures/data_integrations_list_response_data.json",
|
| 988 |
"tests/fixtures/data_integrations_list_response_data_connected_account.json",
|
| 989 |
"tests/fixtures/data_integrations_upsert_api_key_request.json",
|
| 990 |
+
"tests/fixtures/data_integrations_upsert_client_credentials_request.json",
|
| 991 |
"tests/fixtures/data_integrations_vend_credentials_request.json",
|
| 992 |
"tests/fixtures/decrypt_request.json",
|
| 993 |
"tests/fixtures/decrypt_response.json",
|
|
|
|
| 1672 |
"sdkMethod": "authorize_data_integration",
|
| 1673 |
"service": "pipes"
|
| 1674 |
},
|
| 1675 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1676 |
+
"sdkMethod": "update_data_integration_client_credentials",
|
| 1677 |
+
"service": "pipes"
|
| 1678 |
+
},
|
| 1679 |
"POST /data-integrations/{slug}/credentials": {
|
| 1680 |
"sdkMethod": "create_data_integration_credential",
|
| 1681 |
"service": "pipes"
|
python/src/workos/admin_portal/_resource.py|
@@ -2,31 +2,32 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
| 10 |
from .._types import RequestOptions, enum_value
|
| 11 |
from .models import PortalLinkResponse
|
| 12 |
-
from workos.common.models.generate_link_intent import GenerateLinkIntent
|
| 13 |
|
| 14 |
|
| 15 |
class AdminPortal:
|
| 16 |
"""Admin Portal API resources."""
|
| 17 |
|
| 18 |
-
def __init__(self, client:
|
| 19 |
self._client = client
|
| 20 |
|
| 21 |
def generate_link(
|
| 22 |
self,
|
| 23 |
*,
|
| 24 |
organization: str,
|
| 25 |
-
return_url:
|
| 26 |
-
success_url:
|
| 27 |
-
intent:
|
| 28 |
-
it_contact_emails:
|
| 29 |
-
request_options:
|
| 30 |
) -> PortalLinkResponse:
|
| 31 |
"""Generate a Portal Link
|
| 32 |
|
|
@@ -59,7 +60,7 @@ class AdminPortal:
|
|
| 59 |
RateLimitExceededError: If rate limited (429).
|
| 60 |
ServerError: If the server returns a 5xx error.
|
| 61 |
"""
|
| 62 |
-
body:
|
| 63 |
k: v
|
| 64 |
for k, v in {
|
| 65 |
"return_url": return_url,
|
|
@@ -82,18 +83,18 @@ class AdminPortal:
|
|
| 82 |
class AsyncAdminPortal:
|
| 83 |
"""Admin Portal API resources (async)."""
|
| 84 |
|
| 85 |
-
def __init__(self, client:
|
| 86 |
self._client = client
|
| 87 |
|
| 88 |
async def generate_link(
|
| 89 |
self,
|
| 90 |
*,
|
| 91 |
organization: str,
|
| 92 |
-
return_url:
|
| 93 |
-
success_url:
|
| 94 |
-
intent:
|
| 95 |
-
it_contact_emails:
|
| 96 |
-
request_options:
|
| 97 |
) -> PortalLinkResponse:
|
| 98 |
"""Generate a Portal Link
|
| 99 |
|
|
@@ -126,7 +127,7 @@ class AsyncAdminPortal:
|
|
| 126 |
RateLimitExceededError: If rate limited (429).
|
| 127 |
ServerError: If the server returns a 5xx error.
|
| 128 |
"""
|
| 129 |
-
body:
|
| 130 |
k: v
|
| 131 |
for k, v in {
|
| 132 |
"return_url": return_url,
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.generate_link_intent import GenerateLinkIntent
|
| 11 |
+
|
| 12 |
from .._types import RequestOptions, enum_value
|
| 13 |
from .models import PortalLinkResponse
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class AdminPortal:
|
| 17 |
"""Admin Portal API resources."""
|
| 18 |
|
| 19 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 20 |
self._client = client
|
| 21 |
|
| 22 |
def generate_link(
|
| 23 |
self,
|
| 24 |
*,
|
| 25 |
organization: str,
|
| 26 |
+
return_url: str | None = None,
|
| 27 |
+
success_url: str | None = None,
|
| 28 |
+
intent: GenerateLinkIntent | str | None = None,
|
| 29 |
+
it_contact_emails: list[str] | None = None,
|
| 30 |
+
request_options: RequestOptions | None = None,
|
| 31 |
) -> PortalLinkResponse:
|
| 32 |
"""Generate a Portal Link
|
| 33 |
|
|
|
|
| 60 |
RateLimitExceededError: If rate limited (429).
|
| 61 |
ServerError: If the server returns a 5xx error.
|
| 62 |
"""
|
| 63 |
+
body: dict[str, Any] = {
|
| 64 |
k: v
|
| 65 |
for k, v in {
|
| 66 |
"return_url": return_url,
|
|
|
|
| 83 |
class AsyncAdminPortal:
|
| 84 |
"""Admin Portal API resources (async)."""
|
| 85 |
|
| 86 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 87 |
self._client = client
|
| 88 |
|
| 89 |
async def generate_link(
|
| 90 |
self,
|
| 91 |
*,
|
| 92 |
organization: str,
|
| 93 |
+
return_url: str | None = None,
|
| 94 |
+
success_url: str | None = None,
|
| 95 |
+
intent: GenerateLinkIntent | str | None = None,
|
| 96 |
+
it_contact_emails: list[str] | None = None,
|
| 97 |
+
request_options: RequestOptions | None = None,
|
| 98 |
) -> PortalLinkResponse:
|
| 99 |
"""Generate a Portal Link
|
| 100 |
|
|
|
|
| 127 |
RateLimitExceededError: If rate limited (429).
|
| 128 |
ServerError: If the server returns a 5xx error.
|
| 129 |
"""
|
| 130 |
+
body: dict[str, Any] = {
|
| 131 |
k: v
|
| 132 |
for k, v in {
|
| 133 |
"return_url": return_url,
|
python/src/workos/admin_portal/models/generate_link.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.generate_link_intent import GenerateLinkIntent
|
| 10 |
|
|
@@ -15,11 +16,11 @@ class GenerateLink:
|
|
| 15 |
|
| 16 |
organization: str
|
| 17 |
"""An [Organization](https://workos.com/docs/reference/organization) identifier."""
|
| 18 |
-
return_url:
|
| 19 |
"""The URL to go to when an admin clicks on your logo in the Admin Portal. If not specified, the return URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used."""
|
| 20 |
-
success_url:
|
| 21 |
"""The URL to redirect the admin to when they finish setup. If not specified, the success URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used."""
|
| 22 |
-
intent:
|
| 23 |
"""
|
| 24 |
The intent of the Admin Portal.
|
| 25 |
- `sso` - Launch Admin Portal for creating SSO connections
|
|
@@ -29,11 +30,11 @@ class GenerateLink:
|
|
| 29 |
- `domain_verification` - Launch Admin Portal for Domain Verification
|
| 30 |
- `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates
|
| 31 |
- `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key"""
|
| 32 |
-
it_contact_emails:
|
| 33 |
"""The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -48,9 +49,9 @@ class GenerateLink:
|
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("GenerateLink", e)
|
| 50 |
|
| 51 |
-
def to_dict(self) ->
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
-
result:
|
| 54 |
result["organization"] = self.organization
|
| 55 |
if self.return_url is not None:
|
| 56 |
result["return_url"] = self.return_url
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.generate_link_intent import GenerateLinkIntent
|
| 11 |
|
|
|
|
| 16 |
|
| 17 |
organization: str
|
| 18 |
"""An [Organization](https://workos.com/docs/reference/organization) identifier."""
|
| 19 |
+
return_url: str | None = None
|
| 20 |
"""The URL to go to when an admin clicks on your logo in the Admin Portal. If not specified, the return URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used."""
|
| 21 |
+
success_url: str | None = None
|
| 22 |
"""The URL to redirect the admin to when they finish setup. If not specified, the success URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used."""
|
| 23 |
+
intent: GenerateLinkIntent | None = None
|
| 24 |
"""
|
| 25 |
The intent of the Admin Portal.
|
| 26 |
- `sso` - Launch Admin Portal for creating SSO connections
|
|
|
|
| 30 |
- `domain_verification` - Launch Admin Portal for Domain Verification
|
| 31 |
- `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates
|
| 32 |
- `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key"""
|
| 33 |
+
it_contact_emails: list[str] | None = None
|
| 34 |
"""The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> GenerateLink:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("GenerateLink", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["organization"] = self.organization
|
| 56 |
if self.return_url is not None:
|
| 57 |
result["return_url"] = self.return_url
|
python/src/workos/admin_portal/models/portal_link_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class PortalLinkResponse:
|
|
| 15 |
"""An ephemeral link to initiate the Admin Portal."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class PortalLinkResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("PortalLinkResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["link"] = self.link
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""An ephemeral link to initiate the Admin Portal."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> PortalLinkResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("PortalLinkResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["link"] = self.link
|
| 32 |
return result
|
python/src/workos/agents/_resource.py|
@@ -2,11 +2,15 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any,
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from .._types import RequestOptions, enum_value
|
| 11 |
from .models import (
|
| 12 |
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
|
@@ -14,15 +18,12 @@ from .models import (
|
|
| 14 |
AgentRegistration,
|
| 15 |
ClaimViewResponse,
|
| 16 |
)
|
| 17 |
-
from workos.common.models.agent_admin_validate_credential_request_type import (
|
| 18 |
-
AgentAdminValidateCredentialRequestType,
|
| 19 |
-
)
|
| 20 |
|
| 21 |
|
| 22 |
class Agents:
|
| 23 |
"""Agents API resources."""
|
| 24 |
|
| 25 |
-
def __init__(self, client:
|
| 26 |
self._client = client
|
| 27 |
|
| 28 |
def update_attempts(
|
|
@@ -31,8 +32,8 @@ class Agents:
|
|
| 31 |
type: Literal["link_external_user"],
|
| 32 |
claim_attempt_token: str,
|
| 33 |
user: AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 34 |
-
organization_id:
|
| 35 |
-
request_options:
|
| 36 |
) -> ClaimViewResponse:
|
| 37 |
"""Link a claim attempt to an external user
|
| 38 |
|
|
@@ -56,7 +57,7 @@ class Agents:
|
|
| 56 |
RateLimitExceededError: If rate limited (429).
|
| 57 |
ServerError: If the server returns a 5xx error.
|
| 58 |
"""
|
| 59 |
-
body:
|
| 60 |
k: v
|
| 61 |
for k, v in {
|
| 62 |
"type": type,
|
|
@@ -77,10 +78,10 @@ class Agents:
|
|
| 77 |
def create_validate(
|
| 78 |
self,
|
| 79 |
*,
|
| 80 |
-
type:
|
| 81 |
credential: str,
|
| 82 |
-
audience:
|
| 83 |
-
request_options:
|
| 84 |
) -> AgentCredentialValidation:
|
| 85 |
"""Validate an agent credential
|
| 86 |
|
|
@@ -101,7 +102,7 @@ class Agents:
|
|
| 101 |
RateLimitExceededError: If rate limited (429).
|
| 102 |
ServerError: If the server returns a 5xx error.
|
| 103 |
"""
|
| 104 |
-
body:
|
| 105 |
k: v
|
| 106 |
for k, v in {
|
| 107 |
"type": enum_value(type),
|
|
@@ -122,7 +123,7 @@ class Agents:
|
|
| 122 |
self,
|
| 123 |
id: str,
|
| 124 |
*,
|
| 125 |
-
request_options:
|
| 126 |
) -> AgentRegistration:
|
| 127 |
"""Get an agent registration
|
| 128 |
|
|
@@ -152,7 +153,7 @@ class Agents:
|
|
| 152 |
class AsyncAgents:
|
| 153 |
"""Agents API resources (async)."""
|
| 154 |
|
| 155 |
-
def __init__(self, client:
|
| 156 |
self._client = client
|
| 157 |
|
| 158 |
async def update_attempts(
|
|
@@ -161,8 +162,8 @@ class AsyncAgents:
|
|
| 161 |
type: Literal["link_external_user"],
|
| 162 |
claim_attempt_token: str,
|
| 163 |
user: AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 164 |
-
organization_id:
|
| 165 |
-
request_options:
|
| 166 |
) -> ClaimViewResponse:
|
| 167 |
"""Link a claim attempt to an external user
|
| 168 |
|
|
@@ -186,7 +187,7 @@ class AsyncAgents:
|
|
| 186 |
RateLimitExceededError: If rate limited (429).
|
| 187 |
ServerError: If the server returns a 5xx error.
|
| 188 |
"""
|
| 189 |
-
body:
|
| 190 |
k: v
|
| 191 |
for k, v in {
|
| 192 |
"type": type,
|
|
@@ -207,10 +208,10 @@ class AsyncAgents:
|
|
| 207 |
async def create_validate(
|
| 208 |
self,
|
| 209 |
*,
|
| 210 |
-
type:
|
| 211 |
credential: str,
|
| 212 |
-
audience:
|
| 213 |
-
request_options:
|
| 214 |
) -> AgentCredentialValidation:
|
| 215 |
"""Validate an agent credential
|
| 216 |
|
|
@@ -231,7 +232,7 @@ class AsyncAgents:
|
|
| 231 |
RateLimitExceededError: If rate limited (429).
|
| 232 |
ServerError: If the server returns a 5xx error.
|
| 233 |
"""
|
| 234 |
-
body:
|
| 235 |
k: v
|
| 236 |
for k, v in {
|
| 237 |
"type": enum_value(type),
|
|
@@ -252,7 +253,7 @@ class AsyncAgents:
|
|
| 252 |
self,
|
| 253 |
id: str,
|
| 254 |
*,
|
| 255 |
-
request_options:
|
| 256 |
) -> AgentRegistration:
|
| 257 |
"""Get an agent registration
|
| 258 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.agent_admin_validate_credential_request_type import (
|
| 11 |
+
AgentAdminValidateCredentialRequestType,
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
from .._types import RequestOptions, enum_value
|
| 15 |
from .models import (
|
| 16 |
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
|
|
|
| 18 |
AgentRegistration,
|
| 19 |
ClaimViewResponse,
|
| 20 |
)
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
class Agents:
|
| 24 |
"""Agents API resources."""
|
| 25 |
|
| 26 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 27 |
self._client = client
|
| 28 |
|
| 29 |
def update_attempts(
|
|
|
|
| 32 |
type: Literal["link_external_user"],
|
| 33 |
claim_attempt_token: str,
|
| 34 |
user: AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 35 |
+
organization_id: str | None = None,
|
| 36 |
+
request_options: RequestOptions | None = None,
|
| 37 |
) -> ClaimViewResponse:
|
| 38 |
"""Link a claim attempt to an external user
|
| 39 |
|
|
|
|
| 57 |
RateLimitExceededError: If rate limited (429).
|
| 58 |
ServerError: If the server returns a 5xx error.
|
| 59 |
"""
|
| 60 |
+
body: dict[str, Any] = {
|
| 61 |
k: v
|
| 62 |
for k, v in {
|
| 63 |
"type": type,
|
|
|
|
| 78 |
def create_validate(
|
| 79 |
self,
|
| 80 |
*,
|
| 81 |
+
type: AgentAdminValidateCredentialRequestType | str,
|
| 82 |
credential: str,
|
| 83 |
+
audience: str | None = None,
|
| 84 |
+
request_options: RequestOptions | None = None,
|
| 85 |
) -> AgentCredentialValidation:
|
| 86 |
"""Validate an agent credential
|
| 87 |
|
|
|
|
| 102 |
RateLimitExceededError: If rate limited (429).
|
| 103 |
ServerError: If the server returns a 5xx error.
|
| 104 |
"""
|
| 105 |
+
body: dict[str, Any] = {
|
| 106 |
k: v
|
| 107 |
for k, v in {
|
| 108 |
"type": enum_value(type),
|
|
|
|
| 123 |
self,
|
| 124 |
id: str,
|
| 125 |
*,
|
| 126 |
+
request_options: RequestOptions | None = None,
|
| 127 |
) -> AgentRegistration:
|
| 128 |
"""Get an agent registration
|
| 129 |
|
|
|
|
| 153 |
class AsyncAgents:
|
| 154 |
"""Agents API resources (async)."""
|
| 155 |
|
| 156 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 157 |
self._client = client
|
| 158 |
|
| 159 |
async def update_attempts(
|
|
|
|
| 162 |
type: Literal["link_external_user"],
|
| 163 |
claim_attempt_token: str,
|
| 164 |
user: AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 165 |
+
organization_id: str | None = None,
|
| 166 |
+
request_options: RequestOptions | None = None,
|
| 167 |
) -> ClaimViewResponse:
|
| 168 |
"""Link a claim attempt to an external user
|
| 169 |
|
|
|
|
| 187 |
RateLimitExceededError: If rate limited (429).
|
| 188 |
ServerError: If the server returns a 5xx error.
|
| 189 |
"""
|
| 190 |
+
body: dict[str, Any] = {
|
| 191 |
k: v
|
| 192 |
for k, v in {
|
| 193 |
"type": type,
|
|
|
|
| 208 |
async def create_validate(
|
| 209 |
self,
|
| 210 |
*,
|
| 211 |
+
type: AgentAdminValidateCredentialRequestType | str,
|
| 212 |
credential: str,
|
| 213 |
+
audience: str | None = None,
|
| 214 |
+
request_options: RequestOptions | None = None,
|
| 215 |
) -> AgentCredentialValidation:
|
| 216 |
"""Validate an agent credential
|
| 217 |
|
|
|
|
| 232 |
RateLimitExceededError: If rate limited (429).
|
| 233 |
ServerError: If the server returns a 5xx error.
|
| 234 |
"""
|
| 235 |
+
body: dict[str, Any] = {
|
| 236 |
k: v
|
| 237 |
for k, v in {
|
| 238 |
"type": enum_value(type),
|
|
|
|
| 253 |
self,
|
| 254 |
id: str,
|
| 255 |
*,
|
| 256 |
+
request_options: RequestOptions | None = None,
|
| 257 |
) -> AgentRegistration:
|
| 258 |
"""Get an agent registration
|
| 259 |
|
python/src/workos/agents/models/agent_admin_link_claim_attempt_to_external_user_request.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .agent_admin_link_claim_attempt_to_external_user_request_user import (
|
|
@@ -20,22 +20,22 @@ class AgentAdminLinkClaimAttemptToExternalUserRequest:
|
|
| 20 |
"""The operation to perform on the claim attempt. Currently only `link_external_user` is supported."""
|
| 21 |
claim_attempt_token: str
|
| 22 |
"""The token identifying the claim attempt."""
|
| 23 |
-
user:
|
| 24 |
"""The user to attach to the claim attempt, identified by email and external ID."""
|
| 25 |
-
organization_id:
|
| 26 |
"""The organization to place the agent in. Required when the user belongs to more than one organization."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
def from_dict(
|
| 30 |
-
cls, data:
|
| 31 |
-
) ->
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
type=data.get("type", "link_external_user"),
|
| 36 |
claim_attempt_token=data["claim_attempt_token"],
|
| 37 |
user=AgentAdminLinkClaimAttemptToExternalUserRequestUser.from_dict(
|
| 38 |
-
cast(
|
| 39 |
),
|
| 40 |
organization_id=data.get("organization_id"),
|
| 41 |
)
|
|
@@ -44,9 +44,9 @@ class AgentAdminLinkClaimAttemptToExternalUserRequest:
|
|
| 44 |
"AgentAdminLinkClaimAttemptToExternalUserRequest", e
|
| 45 |
)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["type"] = self.type
|
| 51 |
result["claim_attempt_token"] = self.claim_attempt_token
|
| 52 |
result["user"] = self.user.to_dict()
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .agent_admin_link_claim_attempt_to_external_user_request_user import (
|
|
|
|
| 20 |
"""The operation to perform on the claim attempt. Currently only `link_external_user` is supported."""
|
| 21 |
claim_attempt_token: str
|
| 22 |
"""The token identifying the claim attempt."""
|
| 23 |
+
user: AgentAdminLinkClaimAttemptToExternalUserRequestUser
|
| 24 |
"""The user to attach to the claim attempt, identified by email and external ID."""
|
| 25 |
+
organization_id: str | None = None
|
| 26 |
"""The organization to place the agent in. Required when the user belongs to more than one organization."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
def from_dict(
|
| 30 |
+
cls, data: dict[str, Any]
|
| 31 |
+
) -> AgentAdminLinkClaimAttemptToExternalUserRequest:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
type=data.get("type", "link_external_user"),
|
| 36 |
claim_attempt_token=data["claim_attempt_token"],
|
| 37 |
user=AgentAdminLinkClaimAttemptToExternalUserRequestUser.from_dict(
|
| 38 |
+
cast(dict[str, Any], data["user"])
|
| 39 |
),
|
| 40 |
organization_id=data.get("organization_id"),
|
| 41 |
)
|
|
|
|
| 44 |
"AgentAdminLinkClaimAttemptToExternalUserRequest", e
|
| 45 |
)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["type"] = self.type
|
| 51 |
result["claim_attempt_token"] = self.claim_attempt_token
|
| 52 |
result["user"] = self.user.to_dict()
|
python/src/workos/agents/models/agent_admin_link_claim_attempt_to_external_user_request_user.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -18,8 +19,8 @@ class AgentAdminLinkClaimAttemptToExternalUserRequestUser:
|
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -31,9 +32,9 @@ class AgentAdminLinkClaimAttemptToExternalUserRequestUser:
|
|
| 31 |
"AgentAdminLinkClaimAttemptToExternalUserRequestUser", e
|
| 32 |
)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["email"] = self.email
|
| 38 |
result["external_id"] = self.external_id
|
| 39 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> AgentAdminLinkClaimAttemptToExternalUserRequestUser:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 32 |
"AgentAdminLinkClaimAttemptToExternalUserRequestUser", e
|
| 33 |
)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["email"] = self.email
|
| 39 |
result["external_id"] = self.external_id
|
| 40 |
return result
|
python/src/workos/agents/models/agent_admin_validate_credential_request.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.agent_admin_validate_credential_request_type import (
|
| 10 |
AgentAdminValidateCredentialRequestType,
|
|
@@ -15,15 +16,15 @@ from workos.common.models.agent_admin_validate_credential_request_type import (
|
|
| 15 |
class AgentAdminValidateCredentialRequest:
|
| 16 |
"""Agent Admin Validate Credential Request model."""
|
| 17 |
|
| 18 |
-
type:
|
| 19 |
"""The kind of credential being validated โ an agent API key or an agent access token."""
|
| 20 |
credential: str
|
| 21 |
"""The credential value to validate: the API key value for `api_key`, or the access token (JWT) for `access_token`."""
|
| 22 |
-
audience:
|
| 23 |
"""When provided, the access token's `aud` claim is verified against this value. Tokens issued for a different resource are rejected."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -34,9 +35,9 @@ class AgentAdminValidateCredentialRequest:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("AgentAdminValidateCredentialRequest", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 41 |
result["credential"] = self.credential
|
| 42 |
if self.audience is not None:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.agent_admin_validate_credential_request_type import (
|
| 11 |
AgentAdminValidateCredentialRequestType,
|
|
|
|
| 16 |
class AgentAdminValidateCredentialRequest:
|
| 17 |
"""Agent Admin Validate Credential Request model."""
|
| 18 |
|
| 19 |
+
type: AgentAdminValidateCredentialRequestType
|
| 20 |
"""The kind of credential being validated โ an agent API key or an agent access token."""
|
| 21 |
credential: str
|
| 22 |
"""The credential value to validate: the API key value for `api_key`, or the access token (JWT) for `access_token`."""
|
| 23 |
+
audience: str | None = None
|
| 24 |
"""When provided, the access token's `aud` claim is verified against this value. Tokens issued for a different resource are rejected."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentAdminValidateCredentialRequest:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("AgentAdminValidateCredentialRequest", e)
|
| 37 |
|
| 38 |
+
def to_dict(self) -> dict[str, Any]:
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
+
result: dict[str, Any] = {}
|
| 41 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 42 |
result["credential"] = self.credential
|
| 43 |
if self.audience is not None:
|
python/src/workos/agents/models/agent_credential_validation.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -15,13 +15,13 @@ class AgentCredentialValidation:
|
|
| 15 |
|
| 16 |
valid: bool
|
| 17 |
"""Whether the presented credential is valid."""
|
| 18 |
-
registration_id:
|
| 19 |
"""Identifier of the agent registration the credential belongs to, or `null` when the credential is invalid."""
|
| 20 |
-
expires_at:
|
| 21 |
"""The timestamp when the credential expires, or `null` when the credential is invalid."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -34,9 +34,9 @@ class AgentCredentialValidation:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("AgentCredentialValidation", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["valid"] = self.valid
|
| 41 |
if self.registration_id is not None:
|
| 42 |
result["registration_id"] = self.registration_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 15 |
|
| 16 |
valid: bool
|
| 17 |
"""Whether the presented credential is valid."""
|
| 18 |
+
registration_id: str | None
|
| 19 |
"""Identifier of the agent registration the credential belongs to, or `null` when the credential is invalid."""
|
| 20 |
+
expires_at: datetime | None
|
| 21 |
"""The timestamp when the credential expires, or `null` when the credential is invalid."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentCredentialValidation:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("AgentCredentialValidation", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["valid"] = self.valid
|
| 41 |
if self.registration_id is not None:
|
| 42 |
result["registration_id"] = self.registration_id
|
python/src/workos/agents/models/agent_registration.py|
@@ -5,16 +5,15 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any, Dict, Optional
|
| 10 |
-
from workos._types import _raise_deserialize_error
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
-
from .
|
| 14 |
-
from .agent_registration_claim import AgentRegistrationClaim
|
| 15 |
from workos.common.models.agent_registration_kind import AgentRegistrationKind
|
| 16 |
from workos.common.models.agent_registration_status import AgentRegistrationStatus
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
@dataclass(slots=True)
|
| 20 |
class AgentRegistration:
|
|
@@ -22,15 +21,15 @@ class AgentRegistration:
|
|
| 22 |
|
| 23 |
id: str
|
| 24 |
"""Unique identifier of the agent registration."""
|
| 25 |
-
agent_identity:
|
| 26 |
"""The agent identity associated with this registration."""
|
| 27 |
organization_id: str
|
| 28 |
"""Identifier of the organization the agent is registered to."""
|
| 29 |
-
status:
|
| 30 |
"""The current verification status of the registration."""
|
| 31 |
-
kind:
|
| 32 |
"""The kind of agent registration."""
|
| 33 |
-
claim:
|
| 34 |
"""The claim associated with this registration, or `null` if the registration has no claim."""
|
| 35 |
created_at: datetime
|
| 36 |
"""The timestamp when the registration was created."""
|
|
@@ -38,18 +37,18 @@ class AgentRegistration:
|
|
| 38 |
"""The timestamp when the registration was last updated."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
-
def from_dict(cls, data:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
return cls(
|
| 45 |
id=data["id"],
|
| 46 |
agent_identity=AgentRegistrationAgentIdentity.from_dict(
|
| 47 |
-
cast(
|
| 48 |
),
|
| 49 |
organization_id=data["organization_id"],
|
| 50 |
status=AgentRegistrationStatus(data["status"]),
|
| 51 |
kind=AgentRegistrationKind(data["kind"]),
|
| 52 |
-
claim=AgentRegistrationClaim.from_dict(cast(
|
| 53 |
if (_v_claim := data["claim"]) is not None
|
| 54 |
else None,
|
| 55 |
created_at=_parse_datetime(data["created_at"]),
|
|
@@ -58,9 +57,9 @@ class AgentRegistration:
|
|
| 58 |
except (KeyError, ValueError) as e:
|
| 59 |
_raise_deserialize_error("AgentRegistration", e)
|
| 60 |
|
| 61 |
-
def to_dict(self) ->
|
| 62 |
"""Serialize to a dictionary."""
|
| 63 |
-
result:
|
| 64 |
result["id"] = self.id
|
| 65 |
result["agent_identity"] = self.agent_identity.to_dict()
|
| 66 |
result["organization_id"] = self.organization_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, cast
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
|
|
|
| 11 |
from workos.common.models.agent_registration_kind import AgentRegistrationKind
|
| 12 |
from workos.common.models.agent_registration_status import AgentRegistrationStatus
|
| 13 |
|
| 14 |
+
from .agent_registration_agent_identity import AgentRegistrationAgentIdentity
|
| 15 |
+
from .agent_registration_claim import AgentRegistrationClaim
|
| 16 |
+
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
| 19 |
class AgentRegistration:
|
|
|
|
| 21 |
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the agent registration."""
|
| 24 |
+
agent_identity: AgentRegistrationAgentIdentity
|
| 25 |
"""The agent identity associated with this registration."""
|
| 26 |
organization_id: str
|
| 27 |
"""Identifier of the organization the agent is registered to."""
|
| 28 |
+
status: AgentRegistrationStatus
|
| 29 |
"""The current verification status of the registration."""
|
| 30 |
+
kind: AgentRegistrationKind
|
| 31 |
"""The kind of agent registration."""
|
| 32 |
+
claim: AgentRegistrationClaim | None
|
| 33 |
"""The claim associated with this registration, or `null` if the registration has no claim."""
|
| 34 |
created_at: datetime
|
| 35 |
"""The timestamp when the registration was created."""
|
|
|
|
| 37 |
"""The timestamp when the registration was last updated."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistration:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
| 44 |
id=data["id"],
|
| 45 |
agent_identity=AgentRegistrationAgentIdentity.from_dict(
|
| 46 |
+
cast(dict[str, Any], data["agent_identity"])
|
| 47 |
),
|
| 48 |
organization_id=data["organization_id"],
|
| 49 |
status=AgentRegistrationStatus(data["status"]),
|
| 50 |
kind=AgentRegistrationKind(data["kind"]),
|
| 51 |
+
claim=AgentRegistrationClaim.from_dict(cast(dict[str, Any], _v_claim))
|
| 52 |
if (_v_claim := data["claim"]) is not None
|
| 53 |
else None,
|
| 54 |
created_at=_parse_datetime(data["created_at"]),
|
|
|
|
| 57 |
except (KeyError, ValueError) as e:
|
| 58 |
_raise_deserialize_error("AgentRegistration", e)
|
| 59 |
|
| 60 |
+
def to_dict(self) -> dict[str, Any]:
|
| 61 |
"""Serialize to a dictionary."""
|
| 62 |
+
result: dict[str, Any] = {}
|
| 63 |
result["id"] = self.id
|
| 64 |
result["agent_identity"] = self.agent_identity.to_dict()
|
| 65 |
result["organization_id"] = self.organization_id
|
python/src/workos/agents/models/agent_registration_agent_identity.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -15,7 +15,7 @@ class AgentRegistrationAgentIdentity:
|
|
| 15 |
|
| 16 |
id: str
|
| 17 |
"""Unique identifier of the agent identity."""
|
| 18 |
-
userland_user_id:
|
| 19 |
"""Identifier of the AuthKit user the agent identity is bound to, or `null` when the agent is not associated with a user."""
|
| 20 |
created_at: datetime
|
| 21 |
"""The timestamp when the agent identity was created."""
|
|
@@ -23,7 +23,7 @@ class AgentRegistrationAgentIdentity:
|
|
| 23 |
"""The timestamp when the agent identity was last updated."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -35,9 +35,9 @@ class AgentRegistrationAgentIdentity:
|
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("AgentRegistrationAgentIdentity", e)
|
| 37 |
|
| 38 |
-
def to_dict(self) ->
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
-
result:
|
| 41 |
result["id"] = self.id
|
| 42 |
if self.userland_user_id is not None:
|
| 43 |
result["userland_user_id"] = self.userland_user_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 15 |
|
| 16 |
id: str
|
| 17 |
"""Unique identifier of the agent identity."""
|
| 18 |
+
userland_user_id: str | None
|
| 19 |
"""Identifier of the AuthKit user the agent identity is bound to, or `null` when the agent is not associated with a user."""
|
| 20 |
created_at: datetime
|
| 21 |
"""The timestamp when the agent identity was created."""
|
|
|
|
| 23 |
"""The timestamp when the agent identity was last updated."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationAgentIdentity:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
|
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("AgentRegistrationAgentIdentity", e)
|
| 37 |
|
| 38 |
+
def to_dict(self) -> dict[str, Any]:
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
+
result: dict[str, Any] = {}
|
| 41 |
result["id"] = self.id
|
| 42 |
if self.userland_user_id is not None:
|
| 43 |
result["userland_user_id"] = self.userland_user_id
|
python/src/workos/agents/models/agent_registration_claim.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_claim_claim_completion import (
|
| 13 |
AgentRegistrationClaimClaimCompletion,
|
|
@@ -20,7 +19,7 @@ class AgentRegistrationClaim:
|
|
| 20 |
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the claim."""
|
| 23 |
-
claim_completion:
|
| 24 |
"""The completion record for the claim, or `null` if the claim has not been completed."""
|
| 25 |
created_at: datetime
|
| 26 |
"""The timestamp when the claim was created."""
|
|
@@ -30,13 +29,13 @@ class AgentRegistrationClaim:
|
|
| 30 |
"""The timestamp when the claim expires."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
id=data["id"],
|
| 38 |
claim_completion=AgentRegistrationClaimClaimCompletion.from_dict(
|
| 39 |
-
cast(
|
| 40 |
)
|
| 41 |
if (_v_claim_completion := data["claim_completion"]) is not None
|
| 42 |
else None,
|
|
@@ -47,9 +46,9 @@ class AgentRegistrationClaim:
|
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationClaim", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["id"] = self.id
|
| 54 |
if self.claim_completion is not None:
|
| 55 |
result["claim_completion"] = self.claim_completion.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
|
|
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_claim_claim_completion import (
|
| 12 |
AgentRegistrationClaimClaimCompletion,
|
|
|
|
| 19 |
|
| 20 |
id: str
|
| 21 |
"""Unique identifier of the claim."""
|
| 22 |
+
claim_completion: AgentRegistrationClaimClaimCompletion | None
|
| 23 |
"""The completion record for the claim, or `null` if the claim has not been completed."""
|
| 24 |
created_at: datetime
|
| 25 |
"""The timestamp when the claim was created."""
|
|
|
|
| 29 |
"""The timestamp when the claim expires."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaim:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
id=data["id"],
|
| 37 |
claim_completion=AgentRegistrationClaimClaimCompletion.from_dict(
|
| 38 |
+
cast(dict[str, Any], _v_claim_completion)
|
| 39 |
)
|
| 40 |
if (_v_claim_completion := data["claim_completion"]) is not None
|
| 41 |
else None,
|
|
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationClaim", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["id"] = self.id
|
| 53 |
if self.claim_completion is not None:
|
| 54 |
result["claim_completion"] = self.claim_completion.to_dict()
|
python/src/workos/agents/models/agent_registration_claim_claim_completion.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -25,7 +25,7 @@ class AgentRegistrationClaimClaimCompletion:
|
|
| 25 |
"""The timestamp when the claim was completed."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(cls, data:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -38,9 +38,9 @@ class AgentRegistrationClaimClaimCompletion:
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AgentRegistrationClaimClaimCompletion", e)
|
| 40 |
|
| 41 |
-
def to_dict(self) ->
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
-
result:
|
| 44 |
result["id"] = self.id
|
| 45 |
result["created_at"] = _format_datetime(self.created_at)
|
| 46 |
result["updated_at"] = _format_datetime(self.updated_at)
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 25 |
"""The timestamp when the claim was completed."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimClaimCompletion:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AgentRegistrationClaimClaimCompletion", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["id"] = self.id
|
| 45 |
result["created_at"] = _format_datetime(self.created_at)
|
| 46 |
result["updated_at"] = _format_datetime(self.updated_at)
|
python/src/workos/agents/models/claim_view_response.py|
@@ -4,12 +4,12 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 10 |
|
| 11 |
from .claim_view_response_organization import ClaimViewResponseOrganization
|
| 12 |
-
from workos.common.models.claim_view_response_status import ClaimViewResponseStatus
|
| 13 |
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
|
@@ -18,15 +18,15 @@ class ClaimViewResponse:
|
|
| 18 |
|
| 19 |
id: str
|
| 20 |
"""The agent registration ID."""
|
| 21 |
-
status:
|
| 22 |
"""Current status of the agent registration."""
|
| 23 |
user_code: str
|
| 24 |
"""The user code the agent needs to complete the claim."""
|
| 25 |
-
organizations:
|
| 26 |
"""Organizations the user belongs to, offered as placement choices."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
-
def from_dict(cls, data:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
@@ -34,16 +34,16 @@ class ClaimViewResponse:
|
|
| 34 |
status=ClaimViewResponseStatus(data["status"]),
|
| 35 |
user_code=data["user_code"],
|
| 36 |
organizations=[
|
| 37 |
-
ClaimViewResponseOrganization.from_dict(cast(
|
| 38 |
for item in cast(list[Any], data["organizations"])
|
| 39 |
],
|
| 40 |
)
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("ClaimViewResponse", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
result["id"] = self.id
|
| 48 |
result["status"] = (
|
| 49 |
self.status.value if isinstance(self.status, Enum) else self.status
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
from workos.common.models.claim_view_response_status import ClaimViewResponseStatus
|
| 11 |
|
| 12 |
from .claim_view_response_organization import ClaimViewResponseOrganization
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
|
|
|
| 18 |
|
| 19 |
id: str
|
| 20 |
"""The agent registration ID."""
|
| 21 |
+
status: ClaimViewResponseStatus
|
| 22 |
"""Current status of the agent registration."""
|
| 23 |
user_code: str
|
| 24 |
"""The user code the agent needs to complete the claim."""
|
| 25 |
+
organizations: list[ClaimViewResponseOrganization]
|
| 26 |
"""Organizations the user belongs to, offered as placement choices."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
+
def from_dict(cls, data: dict[str, Any]) -> ClaimViewResponse:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 34 |
status=ClaimViewResponseStatus(data["status"]),
|
| 35 |
user_code=data["user_code"],
|
| 36 |
organizations=[
|
| 37 |
+
ClaimViewResponseOrganization.from_dict(cast(dict[str, Any], item))
|
| 38 |
for item in cast(list[Any], data["organizations"])
|
| 39 |
],
|
| 40 |
)
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("ClaimViewResponse", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["id"] = self.id
|
| 48 |
result["status"] = (
|
| 49 |
self.status.value if isinstance(self.status, Enum) else self.status
|
python/src/workos/api_keys/_resource.py|
@@ -2,37 +2,38 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
-
from .._types import
|
| 11 |
from .models import (
|
| 12 |
ApiKey,
|
| 13 |
ApiKeyValidationResponse,
|
| 14 |
OrganizationApiKey,
|
| 15 |
OrganizationApiKeyWithValue,
|
| 16 |
)
|
| 17 |
-
from workos.common.models.pagination_order import PaginationOrder
|
| 18 |
-
from .._pagination import AsyncPage, SyncPage
|
| 19 |
|
| 20 |
|
| 21 |
class ApiKeys:
|
| 22 |
"""Api Keys API resources."""
|
| 23 |
|
| 24 |
-
def __init__(self, client:
|
| 25 |
self._client = client
|
| 26 |
|
| 27 |
def list_organization_api_keys(
|
| 28 |
self,
|
| 29 |
organization_id: str,
|
| 30 |
*,
|
| 31 |
-
limit:
|
| 32 |
-
before:
|
| 33 |
-
after:
|
| 34 |
-
order:
|
| 35 |
-
request_options:
|
| 36 |
) -> SyncPage[OrganizationApiKey]:
|
| 37 |
"""List API keys for an organization
|
| 38 |
|
|
@@ -78,9 +79,9 @@ class ApiKeys:
|
|
| 78 |
organization_id: str,
|
| 79 |
*,
|
| 80 |
name: str,
|
| 81 |
-
permissions:
|
| 82 |
-
expires_at:
|
| 83 |
-
request_options:
|
| 84 |
) -> OrganizationApiKeyWithValue:
|
| 85 |
"""Create an API key for an organization
|
| 86 |
|
|
@@ -103,7 +104,7 @@ class ApiKeys:
|
|
| 103 |
RateLimitExceededError: If rate limited (429).
|
| 104 |
ServerError: If the server returns a 5xx error.
|
| 105 |
"""
|
| 106 |
-
body:
|
| 107 |
k: v
|
| 108 |
for k, v in {
|
| 109 |
"name": name,
|
|
@@ -124,7 +125,7 @@ class ApiKeys:
|
|
| 124 |
self,
|
| 125 |
*,
|
| 126 |
value: str,
|
| 127 |
-
request_options:
|
| 128 |
) -> ApiKeyValidationResponse:
|
| 129 |
"""Validate API key
|
| 130 |
|
|
@@ -143,7 +144,7 @@ class ApiKeys:
|
|
| 143 |
RateLimitExceededError: If rate limited (429).
|
| 144 |
ServerError: If the server returns a 5xx error.
|
| 145 |
"""
|
| 146 |
-
body:
|
| 147 |
"value": value,
|
| 148 |
}
|
| 149 |
return self._client.request(
|
|
@@ -158,7 +159,7 @@ class ApiKeys:
|
|
| 158 |
self,
|
| 159 |
id: str,
|
| 160 |
*,
|
| 161 |
-
request_options:
|
| 162 |
) -> None:
|
| 163 |
"""Delete an API key
|
| 164 |
|
|
@@ -184,8 +185,8 @@ class ApiKeys:
|
|
| 184 |
self,
|
| 185 |
id: str,
|
| 186 |
*,
|
| 187 |
-
expires_at:
|
| 188 |
-
request_options:
|
| 189 |
) -> ApiKey:
|
| 190 |
"""Expire an API key
|
| 191 |
|
|
@@ -207,7 +208,7 @@ class ApiKeys:
|
|
| 207 |
RateLimitExceededError: If rate limited (429).
|
| 208 |
ServerError: If the server returns a 5xx error.
|
| 209 |
"""
|
| 210 |
-
body:
|
| 211 |
if not isinstance(expires_at, NotGiven):
|
| 212 |
body["expires_at"] = expires_at
|
| 213 |
return self._client.request(
|
|
@@ -222,18 +223,18 @@ class ApiKeys:
|
|
| 222 |
class AsyncApiKeys:
|
| 223 |
"""Api Keys API resources (async)."""
|
| 224 |
|
| 225 |
-
def __init__(self, client:
|
| 226 |
self._client = client
|
| 227 |
|
| 228 |
async def list_organization_api_keys(
|
| 229 |
self,
|
| 230 |
organization_id: str,
|
| 231 |
*,
|
| 232 |
-
limit:
|
| 233 |
-
before:
|
| 234 |
-
after:
|
| 235 |
-
order:
|
| 236 |
-
request_options:
|
| 237 |
) -> AsyncPage[OrganizationApiKey]:
|
| 238 |
"""List API keys for an organization
|
| 239 |
|
|
@@ -279,9 +280,9 @@ class AsyncApiKeys:
|
|
| 279 |
organization_id: str,
|
| 280 |
*,
|
| 281 |
name: str,
|
| 282 |
-
permissions:
|
| 283 |
-
expires_at:
|
| 284 |
-
request_options:
|
| 285 |
) -> OrganizationApiKeyWithValue:
|
| 286 |
"""Create an API key for an organization
|
| 287 |
|
|
@@ -304,7 +305,7 @@ class AsyncApiKeys:
|
|
| 304 |
RateLimitExceededError: If rate limited (429).
|
| 305 |
ServerError: If the server returns a 5xx error.
|
| 306 |
"""
|
| 307 |
-
body:
|
| 308 |
k: v
|
| 309 |
for k, v in {
|
| 310 |
"name": name,
|
|
@@ -325,7 +326,7 @@ class AsyncApiKeys:
|
|
| 325 |
self,
|
| 326 |
*,
|
| 327 |
value: str,
|
| 328 |
-
request_options:
|
| 329 |
) -> ApiKeyValidationResponse:
|
| 330 |
"""Validate API key
|
| 331 |
|
|
@@ -344,7 +345,7 @@ class AsyncApiKeys:
|
|
| 344 |
RateLimitExceededError: If rate limited (429).
|
| 345 |
ServerError: If the server returns a 5xx error.
|
| 346 |
"""
|
| 347 |
-
body:
|
| 348 |
"value": value,
|
| 349 |
}
|
| 350 |
return await self._client.request(
|
|
@@ -359,7 +360,7 @@ class AsyncApiKeys:
|
|
| 359 |
self,
|
| 360 |
id: str,
|
| 361 |
*,
|
| 362 |
-
request_options:
|
| 363 |
) -> None:
|
| 364 |
"""Delete an API key
|
| 365 |
|
|
@@ -385,8 +386,8 @@ class AsyncApiKeys:
|
|
| 385 |
self,
|
| 386 |
id: str,
|
| 387 |
*,
|
| 388 |
-
expires_at:
|
| 389 |
-
request_options:
|
| 390 |
) -> ApiKey:
|
| 391 |
"""Expire an API key
|
| 392 |
|
|
@@ -408,7 +409,7 @@ class AsyncApiKeys:
|
|
| 408 |
RateLimitExceededError: If rate limited (429).
|
| 409 |
ServerError: If the server returns a 5xx error.
|
| 410 |
"""
|
| 411 |
-
body:
|
| 412 |
if not isinstance(expires_at, NotGiven):
|
| 413 |
body["expires_at"] = expires_at
|
| 414 |
return await self._client.request(
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 11 |
+
|
| 12 |
+
from .._pagination import AsyncPage, SyncPage
|
| 13 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 14 |
from .models import (
|
| 15 |
ApiKey,
|
| 16 |
ApiKeyValidationResponse,
|
| 17 |
OrganizationApiKey,
|
| 18 |
OrganizationApiKeyWithValue,
|
| 19 |
)
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
class ApiKeys:
|
| 23 |
"""Api Keys API resources."""
|
| 24 |
|
| 25 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 26 |
self._client = client
|
| 27 |
|
| 28 |
def list_organization_api_keys(
|
| 29 |
self,
|
| 30 |
organization_id: str,
|
| 31 |
*,
|
| 32 |
+
limit: int | None = None,
|
| 33 |
+
before: str | None = None,
|
| 34 |
+
after: str | None = None,
|
| 35 |
+
order: PaginationOrder | str | None = "desc",
|
| 36 |
+
request_options: RequestOptions | None = None,
|
| 37 |
) -> SyncPage[OrganizationApiKey]:
|
| 38 |
"""List API keys for an organization
|
| 39 |
|
|
|
|
| 79 |
organization_id: str,
|
| 80 |
*,
|
| 81 |
name: str,
|
| 82 |
+
permissions: list[str] | None = None,
|
| 83 |
+
expires_at: str | None = None,
|
| 84 |
+
request_options: RequestOptions | None = None,
|
| 85 |
) -> OrganizationApiKeyWithValue:
|
| 86 |
"""Create an API key for an organization
|
| 87 |
|
|
|
|
| 104 |
RateLimitExceededError: If rate limited (429).
|
| 105 |
ServerError: If the server returns a 5xx error.
|
| 106 |
"""
|
| 107 |
+
body: dict[str, Any] = {
|
| 108 |
k: v
|
| 109 |
for k, v in {
|
| 110 |
"name": name,
|
|
|
|
| 125 |
self,
|
| 126 |
*,
|
| 127 |
value: str,
|
| 128 |
+
request_options: RequestOptions | None = None,
|
| 129 |
) -> ApiKeyValidationResponse:
|
| 130 |
"""Validate API key
|
| 131 |
|
|
|
|
| 144 |
RateLimitExceededError: If rate limited (429).
|
| 145 |
ServerError: If the server returns a 5xx error.
|
| 146 |
"""
|
| 147 |
+
body: dict[str, Any] = {
|
| 148 |
"value": value,
|
| 149 |
}
|
| 150 |
return self._client.request(
|
|
|
|
| 159 |
self,
|
| 160 |
id: str,
|
| 161 |
*,
|
| 162 |
+
request_options: RequestOptions | None = None,
|
| 163 |
) -> None:
|
| 164 |
"""Delete an API key
|
| 165 |
|
|
|
|
| 185 |
self,
|
| 186 |
id: str,
|
| 187 |
*,
|
| 188 |
+
expires_at: str | None | NotGiven = NOT_GIVEN,
|
| 189 |
+
request_options: RequestOptions | None = None,
|
| 190 |
) -> ApiKey:
|
| 191 |
"""Expire an API key
|
| 192 |
|
|
|
|
| 208 |
RateLimitExceededError: If rate limited (429).
|
| 209 |
ServerError: If the server returns a 5xx error.
|
| 210 |
"""
|
| 211 |
+
body: dict[str, Any] = {}
|
| 212 |
if not isinstance(expires_at, NotGiven):
|
| 213 |
body["expires_at"] = expires_at
|
| 214 |
return self._client.request(
|
|
|
|
| 223 |
class AsyncApiKeys:
|
| 224 |
"""Api Keys API resources (async)."""
|
| 225 |
|
| 226 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 227 |
self._client = client
|
| 228 |
|
| 229 |
async def list_organization_api_keys(
|
| 230 |
self,
|
| 231 |
organization_id: str,
|
| 232 |
*,
|
| 233 |
+
limit: int | None = None,
|
| 234 |
+
before: str | None = None,
|
| 235 |
+
after: str | None = None,
|
| 236 |
+
order: PaginationOrder | str | None = "desc",
|
| 237 |
+
request_options: RequestOptions | None = None,
|
| 238 |
) -> AsyncPage[OrganizationApiKey]:
|
| 239 |
"""List API keys for an organization
|
| 240 |
|
|
|
|
| 280 |
organization_id: str,
|
| 281 |
*,
|
| 282 |
name: str,
|
| 283 |
+
permissions: list[str] | None = None,
|
| 284 |
+
expires_at: str | None = None,
|
| 285 |
+
request_options: RequestOptions | None = None,
|
| 286 |
) -> OrganizationApiKeyWithValue:
|
| 287 |
"""Create an API key for an organization
|
| 288 |
|
|
|
|
| 305 |
RateLimitExceededError: If rate limited (429).
|
| 306 |
ServerError: If the server returns a 5xx error.
|
| 307 |
"""
|
| 308 |
+
body: dict[str, Any] = {
|
| 309 |
k: v
|
| 310 |
for k, v in {
|
| 311 |
"name": name,
|
|
|
|
| 326 |
self,
|
| 327 |
*,
|
| 328 |
value: str,
|
| 329 |
+
request_options: RequestOptions | None = None,
|
| 330 |
) -> ApiKeyValidationResponse:
|
| 331 |
"""Validate API key
|
| 332 |
|
|
|
|
| 345 |
RateLimitExceededError: If rate limited (429).
|
| 346 |
ServerError: If the server returns a 5xx error.
|
| 347 |
"""
|
| 348 |
+
body: dict[str, Any] = {
|
| 349 |
"value": value,
|
| 350 |
}
|
| 351 |
return await self._client.request(
|
|
|
|
| 360 |
self,
|
| 361 |
id: str,
|
| 362 |
*,
|
| 363 |
+
request_options: RequestOptions | None = None,
|
| 364 |
) -> None:
|
| 365 |
"""Delete an API key
|
| 366 |
|
|
|
|
| 386 |
self,
|
| 387 |
id: str,
|
| 388 |
*,
|
| 389 |
+
expires_at: str | None | NotGiven = NOT_GIVEN,
|
| 390 |
+
request_options: RequestOptions | None = None,
|
| 391 |
) -> ApiKey:
|
| 392 |
"""Expire an API key
|
| 393 |
|
|
|
|
| 409 |
RateLimitExceededError: If rate limited (429).
|
| 410 |
ServerError: If the server returns a 5xx error.
|
| 411 |
"""
|
| 412 |
+
body: dict[str, Any] = {}
|
| 413 |
if not isinstance(expires_at, NotGiven):
|
| 414 |
body["expires_at"] = expires_at
|
| 415 |
return await self._client.request(
|
python/src/workos/api_keys/models/api_key.py|
@@ -4,14 +4,13 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any, Dict, List, Literal, Optional, Union
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
-
from .
|
| 13 |
from workos.user_management.models.user_api_key_owner import UserApiKeyOwner
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
@dataclass(slots=True)
|
| 17 |
class ApiKey:
|
|
@@ -21,17 +20,17 @@ class ApiKey:
|
|
| 21 |
"""Distinguishes the API Key object."""
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the API Key."""
|
| 24 |
-
owner:
|
| 25 |
"""The entity that owns the API Key."""
|
| 26 |
name: str
|
| 27 |
"""A descriptive name for the API Key."""
|
| 28 |
obfuscated_value: str
|
| 29 |
"""An obfuscated representation of the API Key value."""
|
| 30 |
-
last_used_at:
|
| 31 |
"""Timestamp of when the API Key was last used."""
|
| 32 |
-
expires_at:
|
| 33 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 34 |
-
permissions:
|
| 35 |
"""The permission slugs assigned to the API Key."""
|
| 36 |
created_at: datetime
|
| 37 |
"""An ISO 8601 timestamp."""
|
|
@@ -39,13 +38,13 @@ class ApiKey:
|
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
|
| 41 |
@classmethod
|
| 42 |
-
def from_dict(cls, data:
|
| 43 |
"""Deserialize from a dictionary."""
|
| 44 |
try:
|
| 45 |
_owner_raw = data["owner"]
|
| 46 |
-
_owner_data = cast(
|
| 47 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 48 |
-
_owner_disc_map:
|
| 49 |
"organization": ApiKeyOwner,
|
| 50 |
"user": UserApiKeyOwner,
|
| 51 |
}
|
|
@@ -74,9 +73,9 @@ class ApiKey:
|
|
| 74 |
except (KeyError, ValueError) as e:
|
| 75 |
_raise_deserialize_error("ApiKey", e)
|
| 76 |
|
| 77 |
-
def to_dict(self) ->
|
| 78 |
"""Serialize to a dictionary."""
|
| 79 |
-
result:
|
| 80 |
result["object"] = self.object
|
| 81 |
result["id"] = self.id
|
| 82 |
result["owner"] = self.owner.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
from workos.user_management.models.user_api_key_owner import UserApiKeyOwner
|
| 11 |
|
| 12 |
+
from .api_key_owner import ApiKeyOwner
|
| 13 |
+
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
| 16 |
class ApiKey:
|
|
|
|
| 20 |
"""Distinguishes the API Key object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the API Key."""
|
| 23 |
+
owner: ApiKeyOwner | UserApiKeyOwner
|
| 24 |
"""The entity that owns the API Key."""
|
| 25 |
name: str
|
| 26 |
"""A descriptive name for the API Key."""
|
| 27 |
obfuscated_value: str
|
| 28 |
"""An obfuscated representation of the API Key value."""
|
| 29 |
+
last_used_at: datetime | None
|
| 30 |
"""Timestamp of when the API Key was last used."""
|
| 31 |
+
expires_at: datetime | None
|
| 32 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 33 |
+
permissions: list[str]
|
| 34 |
"""The permission slugs assigned to the API Key."""
|
| 35 |
created_at: datetime
|
| 36 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKey:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
_owner_raw = data["owner"]
|
| 45 |
+
_owner_data = cast(dict[str, Any], _owner_raw)
|
| 46 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 47 |
+
_owner_disc_map: dict[str, Any] = {
|
| 48 |
"organization": ApiKeyOwner,
|
| 49 |
"user": UserApiKeyOwner,
|
| 50 |
}
|
|
|
|
| 73 |
except (KeyError, ValueError) as e:
|
| 74 |
_raise_deserialize_error("ApiKey", e)
|
| 75 |
|
| 76 |
+
def to_dict(self) -> dict[str, Any]:
|
| 77 |
"""Serialize to a dictionary."""
|
| 78 |
+
result: dict[str, Any] = {}
|
| 79 |
result["object"] = self.object
|
| 80 |
result["id"] = self.id
|
| 81 |
result["owner"] = self.owner.to_dict()
|
python/src/workos/api_keys/models/api_key_validation_response.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .api_key import ApiKey
|
|
@@ -14,16 +14,16 @@ from .api_key import ApiKey
|
|
| 14 |
class ApiKeyValidationResponse:
|
| 15 |
"""Api Key Validation Response model."""
|
| 16 |
|
| 17 |
-
api_key:
|
| 18 |
-
agent_registration_id:
|
| 19 |
"""The ID of the agent registration this API Key was issued for. Present only when the API Key is assigned to an agent registration."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
| 26 |
-
api_key=ApiKey.from_dict(cast(
|
| 27 |
if (_v_api_key := data["api_key"]) is not None
|
| 28 |
else None,
|
| 29 |
agent_registration_id=data.get("agent_registration_id"),
|
|
@@ -31,9 +31,9 @@ class ApiKeyValidationResponse:
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("ApiKeyValidationResponse", e)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
if self.api_key is not None:
|
| 38 |
result["api_key"] = self.api_key.to_dict()
|
| 39 |
else:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .api_key import ApiKey
|
|
|
|
| 14 |
class ApiKeyValidationResponse:
|
| 15 |
"""Api Key Validation Response model."""
|
| 16 |
|
| 17 |
+
api_key: ApiKey | None
|
| 18 |
+
agent_registration_id: str | None = None
|
| 19 |
"""The ID of the agent registration this API Key was issued for. Present only when the API Key is assigned to an agent registration."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyValidationResponse:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
| 26 |
+
api_key=ApiKey.from_dict(cast(dict[str, Any], _v_api_key))
|
| 27 |
if (_v_api_key := data["api_key"]) is not None
|
| 28 |
else None,
|
| 29 |
agent_registration_id=data.get("agent_registration_id"),
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("ApiKeyValidationResponse", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
if self.api_key is not None:
|
| 38 |
result["api_key"] = self.api_key.to_dict()
|
| 39 |
else:
|
python/src/workos/api_keys/models/create_organization_api_key.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -15,13 +15,13 @@ class CreateOrganizationApiKey:
|
|
| 15 |
|
| 16 |
name: str
|
| 17 |
"""The name for the API key."""
|
| 18 |
-
permissions:
|
| 19 |
"""The permission slugs to assign to the API key."""
|
| 20 |
-
expires_at:
|
| 21 |
"""The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -34,9 +34,9 @@ class CreateOrganizationApiKey:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateOrganizationApiKey", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["name"] = self.name
|
| 41 |
if self.permissions is not None:
|
| 42 |
result["permissions"] = self.permissions
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 15 |
|
| 16 |
name: str
|
| 17 |
"""The name for the API key."""
|
| 18 |
+
permissions: list[str] | None = None
|
| 19 |
"""The permission slugs to assign to the API key."""
|
| 20 |
+
expires_at: datetime | None = None
|
| 21 |
"""The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationApiKey:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateOrganizationApiKey", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["name"] = self.name
|
| 41 |
if self.permissions is not None:
|
| 42 |
result["permissions"] = self.permissions
|
python/src/workos/api_keys/models/expire_api_key.py|
@@ -4,20 +4,20 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
| 13 |
class ExpireApiKey:
|
| 14 |
"""Expire Api Key model."""
|
| 15 |
|
| 16 |
-
expires_at:
|
| 17 |
"""When the API key should expire. If omitted or in the past, the key expires immediately. Use null to clear a scheduled future expiration."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -28,9 +28,9 @@ class ExpireApiKey:
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ExpireApiKey", e)
|
| 30 |
|
| 31 |
-
def to_dict(self) ->
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
-
result:
|
| 34 |
if self.expires_at is not None:
|
| 35 |
result["expires_at"] = _format_datetime(self.expires_at)
|
| 36 |
else:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
| 13 |
class ExpireApiKey:
|
| 14 |
"""Expire Api Key model."""
|
| 15 |
|
| 16 |
+
expires_at: datetime | None = None
|
| 17 |
"""When the API key should expire. If omitted or in the past, the key expires immediately. Use null to clear a scheduled future expiration."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def from_dict(cls, data: dict[str, Any]) -> ExpireApiKey:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ExpireApiKey", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.expires_at is not None:
|
| 35 |
result["expires_at"] = _format_datetime(self.expires_at)
|
| 36 |
else:
|
python/src/workos/api_keys/models/organization_api_key.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .organization_api_key_owner import OrganizationApiKeyOwner
|
| 13 |
|
|
@@ -20,17 +19,17 @@ class OrganizationApiKey:
|
|
| 20 |
"""Distinguishes the API Key object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the API Key."""
|
| 23 |
-
owner:
|
| 24 |
"""The entity that owns the API Key."""
|
| 25 |
name: str
|
| 26 |
"""A descriptive name for the API Key."""
|
| 27 |
obfuscated_value: str
|
| 28 |
"""An obfuscated representation of the API Key value."""
|
| 29 |
-
last_used_at:
|
| 30 |
"""Timestamp of when the API Key was last used."""
|
| 31 |
-
expires_at:
|
| 32 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 33 |
-
permissions:
|
| 34 |
"""The permission slugs assigned to the API Key."""
|
| 35 |
created_at: datetime
|
| 36 |
"""An ISO 8601 timestamp."""
|
|
@@ -38,14 +37,14 @@ class OrganizationApiKey:
|
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
-
def from_dict(cls, data:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
return cls(
|
| 45 |
object=data.get("object", "api_key"),
|
| 46 |
id=data["id"],
|
| 47 |
owner=OrganizationApiKeyOwner.from_dict(
|
| 48 |
-
cast(
|
| 49 |
),
|
| 50 |
name=data["name"],
|
| 51 |
obfuscated_value=data["obfuscated_value"],
|
|
@@ -62,9 +61,9 @@ class OrganizationApiKey:
|
|
| 62 |
except (KeyError, ValueError) as e:
|
| 63 |
_raise_deserialize_error("OrganizationApiKey", e)
|
| 64 |
|
| 65 |
-
def to_dict(self) ->
|
| 66 |
"""Serialize to a dictionary."""
|
| 67 |
-
result:
|
| 68 |
result["object"] = self.object
|
| 69 |
result["id"] = self.id
|
| 70 |
result["owner"] = self.owner.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .organization_api_key_owner import OrganizationApiKeyOwner
|
| 12 |
|
|
|
|
| 19 |
"""Distinguishes the API Key object."""
|
| 20 |
id: str
|
| 21 |
"""Unique identifier of the API Key."""
|
| 22 |
+
owner: OrganizationApiKeyOwner
|
| 23 |
"""The entity that owns the API Key."""
|
| 24 |
name: str
|
| 25 |
"""A descriptive name for the API Key."""
|
| 26 |
obfuscated_value: str
|
| 27 |
"""An obfuscated representation of the API Key value."""
|
| 28 |
+
last_used_at: datetime | None
|
| 29 |
"""Timestamp of when the API Key was last used."""
|
| 30 |
+
expires_at: datetime | None
|
| 31 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 32 |
+
permissions: list[str]
|
| 33 |
"""The permission slugs assigned to the API Key."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationApiKey:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
| 44 |
object=data.get("object", "api_key"),
|
| 45 |
id=data["id"],
|
| 46 |
owner=OrganizationApiKeyOwner.from_dict(
|
| 47 |
+
cast(dict[str, Any], data["owner"])
|
| 48 |
),
|
| 49 |
name=data["name"],
|
| 50 |
obfuscated_value=data["obfuscated_value"],
|
|
|
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("OrganizationApiKey", e)
|
| 63 |
|
| 64 |
+
def to_dict(self) -> dict[str, Any]:
|
| 65 |
"""Serialize to a dictionary."""
|
| 66 |
+
result: dict[str, Any] = {}
|
| 67 |
result["object"] = self.object
|
| 68 |
result["id"] = self.id
|
| 69 |
result["owner"] = self.owner.to_dict()
|
python/src/workos/api_keys/models/organization_api_key_with_value.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .organization_api_key_with_value_owner import OrganizationApiKeyWithValueOwner
|
| 13 |
|
|
@@ -20,17 +19,17 @@ class OrganizationApiKeyWithValue:
|
|
| 20 |
"""Distinguishes the API Key object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the API Key."""
|
| 23 |
-
owner:
|
| 24 |
"""The entity that owns the API Key."""
|
| 25 |
name: str
|
| 26 |
"""A descriptive name for the API Key."""
|
| 27 |
obfuscated_value: str
|
| 28 |
"""An obfuscated representation of the API Key value."""
|
| 29 |
-
last_used_at:
|
| 30 |
"""Timestamp of when the API Key was last used."""
|
| 31 |
-
expires_at:
|
| 32 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 33 |
-
permissions:
|
| 34 |
"""The permission slugs assigned to the API Key."""
|
| 35 |
created_at: datetime
|
| 36 |
"""An ISO 8601 timestamp."""
|
|
@@ -40,14 +39,14 @@ class OrganizationApiKeyWithValue:
|
|
| 40 |
"""The full API Key value. Only returned once at creation time."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
-
def from_dict(cls, data:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
| 47 |
object=data.get("object", "api_key"),
|
| 48 |
id=data["id"],
|
| 49 |
owner=OrganizationApiKeyWithValueOwner.from_dict(
|
| 50 |
-
cast(
|
| 51 |
),
|
| 52 |
name=data["name"],
|
| 53 |
obfuscated_value=data["obfuscated_value"],
|
|
@@ -65,9 +64,9 @@ class OrganizationApiKeyWithValue:
|
|
| 65 |
except (KeyError, ValueError) as e:
|
| 66 |
_raise_deserialize_error("OrganizationApiKeyWithValue", e)
|
| 67 |
|
| 68 |
-
def to_dict(self) ->
|
| 69 |
"""Serialize to a dictionary."""
|
| 70 |
-
result:
|
| 71 |
result["object"] = self.object
|
| 72 |
result["id"] = self.id
|
| 73 |
result["owner"] = self.owner.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .organization_api_key_with_value_owner import OrganizationApiKeyWithValueOwner
|
| 12 |
|
|
|
|
| 19 |
"""Distinguishes the API Key object."""
|
| 20 |
id: str
|
| 21 |
"""Unique identifier of the API Key."""
|
| 22 |
+
owner: OrganizationApiKeyWithValueOwner
|
| 23 |
"""The entity that owns the API Key."""
|
| 24 |
name: str
|
| 25 |
"""A descriptive name for the API Key."""
|
| 26 |
obfuscated_value: str
|
| 27 |
"""An obfuscated representation of the API Key value."""
|
| 28 |
+
last_used_at: datetime | None
|
| 29 |
"""Timestamp of when the API Key was last used."""
|
| 30 |
+
expires_at: datetime | None
|
| 31 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 32 |
+
permissions: list[str]
|
| 33 |
"""The permission slugs assigned to the API Key."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 39 |
"""The full API Key value. Only returned once at creation time."""
|
| 40 |
|
| 41 |
@classmethod
|
| 42 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationApiKeyWithValue:
|
| 43 |
"""Deserialize from a dictionary."""
|
| 44 |
try:
|
| 45 |
return cls(
|
| 46 |
object=data.get("object", "api_key"),
|
| 47 |
id=data["id"],
|
| 48 |
owner=OrganizationApiKeyWithValueOwner.from_dict(
|
| 49 |
+
cast(dict[str, Any], data["owner"])
|
| 50 |
),
|
| 51 |
name=data["name"],
|
| 52 |
obfuscated_value=data["obfuscated_value"],
|
|
|
|
| 64 |
except (KeyError, ValueError) as e:
|
| 65 |
_raise_deserialize_error("OrganizationApiKeyWithValue", e)
|
| 66 |
|
| 67 |
+
def to_dict(self) -> dict[str, Any]:
|
| 68 |
"""Serialize to a dictionary."""
|
| 69 |
+
result: dict[str, Any] = {}
|
| 70 |
result["object"] = self.object
|
| 71 |
result["id"] = self.id
|
| 72 |
result["owner"] = self.owner.to_dict()
|
python/src/workos/api_keys/models/validate_api_key.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class ValidateApiKey:
|
|
| 15 |
"""The value for an API key."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class ValidateApiKey:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("ValidateApiKey", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["value"] = self.value
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The value for an API key."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> ValidateApiKey:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("ValidateApiKey", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["value"] = self.value
|
| 32 |
return result
|
python/src/workos/audit_logs/_resource.py|
@@ -2,11 +2,15 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from .._types import RequestOptions, enum_value
|
| 11 |
from .models import (
|
| 12 |
AuditLogAction,
|
|
@@ -17,22 +21,19 @@ from .models import (
|
|
| 17 |
AuditLogSchemaActorInput,
|
| 18 |
AuditLogSchemaTargetInput,
|
| 19 |
)
|
| 20 |
-
from workos.organizations.models.audit_logs_retention import AuditLogsRetention
|
| 21 |
-
from workos.common.models.pagination_order import PaginationOrder
|
| 22 |
-
from .._pagination import AsyncPage, SyncPage
|
| 23 |
|
| 24 |
|
| 25 |
class AuditLogs:
|
| 26 |
"""Audit Logs API resources."""
|
| 27 |
|
| 28 |
-
def __init__(self, client:
|
| 29 |
self._client = client
|
| 30 |
|
| 31 |
def get_organization_audit_logs_retention(
|
| 32 |
self,
|
| 33 |
id: str,
|
| 34 |
*,
|
| 35 |
-
request_options:
|
| 36 |
) -> AuditLogsRetention:
|
| 37 |
"""Get Retention
|
| 38 |
|
|
@@ -63,7 +64,7 @@ class AuditLogs:
|
|
| 63 |
id: str,
|
| 64 |
*,
|
| 65 |
retention_period_in_days: int,
|
| 66 |
-
request_options:
|
| 67 |
) -> AuditLogsRetention:
|
| 68 |
"""Set Retention
|
| 69 |
|
|
@@ -84,7 +85,7 @@ class AuditLogs:
|
|
| 84 |
RateLimitExceededError: If rate limited (429).
|
| 85 |
ServerError: If the server returns a 5xx error.
|
| 86 |
"""
|
| 87 |
-
body:
|
| 88 |
"retention_period_in_days": retention_period_in_days,
|
| 89 |
}
|
| 90 |
return self._client.request(
|
|
@@ -98,11 +99,11 @@ class AuditLogs:
|
|
| 98 |
def list_actions(
|
| 99 |
self,
|
| 100 |
*,
|
| 101 |
-
limit:
|
| 102 |
-
before:
|
| 103 |
-
after:
|
| 104 |
-
order:
|
| 105 |
-
request_options:
|
| 106 |
) -> SyncPage[AuditLogAction]:
|
| 107 |
"""List Actions
|
| 108 |
|
|
@@ -147,11 +148,11 @@ class AuditLogs:
|
|
| 147 |
self,
|
| 148 |
action_name: str,
|
| 149 |
*,
|
| 150 |
-
limit:
|
| 151 |
-
before:
|
| 152 |
-
after:
|
| 153 |
-
order:
|
| 154 |
-
request_options:
|
| 155 |
) -> SyncPage[AuditLogSchema]:
|
| 156 |
"""List Schemas
|
| 157 |
|
|
@@ -197,10 +198,10 @@ class AuditLogs:
|
|
| 197 |
self,
|
| 198 |
action_name: str,
|
| 199 |
*,
|
| 200 |
-
targets:
|
| 201 |
-
actor:
|
| 202 |
-
metadata:
|
| 203 |
-
request_options:
|
| 204 |
) -> AuditLogSchema:
|
| 205 |
"""Create Schema
|
| 206 |
|
|
@@ -222,7 +223,7 @@ class AuditLogs:
|
|
| 222 |
RateLimitExceededError: If rate limited (429).
|
| 223 |
ServerError: If the server returns a 5xx error.
|
| 224 |
"""
|
| 225 |
-
body:
|
| 226 |
k: v
|
| 227 |
for k, v in {
|
| 228 |
"actor": actor.to_dict() if actor is not None else None,
|
|
@@ -244,8 +245,8 @@ class AuditLogs:
|
|
| 244 |
*,
|
| 245 |
organization_id: str,
|
| 246 |
event: AuditLogEvent,
|
| 247 |
-
idempotency_key:
|
| 248 |
-
request_options:
|
| 249 |
) -> AuditLogEventCreateResponse:
|
| 250 |
"""Create Event
|
| 251 |
|
|
@@ -274,7 +275,7 @@ class AuditLogs:
|
|
| 274 |
AuthenticationError: If the API key is invalid (401).
|
| 275 |
ServerError: If the server returns a 5xx error.
|
| 276 |
"""
|
| 277 |
-
body:
|
| 278 |
"organization_id": organization_id,
|
| 279 |
"event": event.to_dict(),
|
| 280 |
}
|
|
@@ -293,12 +294,12 @@ class AuditLogs:
|
|
| 293 |
organization_id: str,
|
| 294 |
range_start: str,
|
| 295 |
range_end: str,
|
| 296 |
-
actions:
|
| 297 |
-
actors:
|
| 298 |
-
actor_names:
|
| 299 |
-
actor_ids:
|
| 300 |
-
targets:
|
| 301 |
-
request_options:
|
| 302 |
) -> AuditLogExport:
|
| 303 |
"""Create Export
|
| 304 |
|
|
@@ -324,7 +325,7 @@ class AuditLogs:
|
|
| 324 |
RateLimitExceededError: If rate limited (429).
|
| 325 |
ServerError: If the server returns a 5xx error.
|
| 326 |
"""
|
| 327 |
-
body:
|
| 328 |
k: v
|
| 329 |
for k, v in {
|
| 330 |
"organization_id": organization_id,
|
|
@@ -350,7 +351,7 @@ class AuditLogs:
|
|
| 350 |
self,
|
| 351 |
audit_log_export_id: str,
|
| 352 |
*,
|
| 353 |
-
request_options:
|
| 354 |
) -> AuditLogExport:
|
| 355 |
"""Get Export
|
| 356 |
|
|
@@ -380,14 +381,14 @@ class AuditLogs:
|
|
| 380 |
class AsyncAuditLogs:
|
| 381 |
"""Audit Logs API resources (async)."""
|
| 382 |
|
| 383 |
-
def __init__(self, client:
|
| 384 |
self._client = client
|
| 385 |
|
| 386 |
async def get_organization_audit_logs_retention(
|
| 387 |
self,
|
| 388 |
id: str,
|
| 389 |
*,
|
| 390 |
-
request_options:
|
| 391 |
) -> AuditLogsRetention:
|
| 392 |
"""Get Retention
|
| 393 |
|
|
@@ -418,7 +419,7 @@ class AsyncAuditLogs:
|
|
| 418 |
id: str,
|
| 419 |
*,
|
| 420 |
retention_period_in_days: int,
|
| 421 |
-
request_options:
|
| 422 |
) -> AuditLogsRetention:
|
| 423 |
"""Set Retention
|
| 424 |
|
|
@@ -439,7 +440,7 @@ class AsyncAuditLogs:
|
|
| 439 |
RateLimitExceededError: If rate limited (429).
|
| 440 |
ServerError: If the server returns a 5xx error.
|
| 441 |
"""
|
| 442 |
-
body:
|
| 443 |
"retention_period_in_days": retention_period_in_days,
|
| 444 |
}
|
| 445 |
return await self._client.request(
|
|
@@ -453,11 +454,11 @@ class AsyncAuditLogs:
|
|
| 453 |
async def list_actions(
|
| 454 |
self,
|
| 455 |
*,
|
| 456 |
-
limit:
|
| 457 |
-
before:
|
| 458 |
-
after:
|
| 459 |
-
order:
|
| 460 |
-
request_options:
|
| 461 |
) -> AsyncPage[AuditLogAction]:
|
| 462 |
"""List Actions
|
| 463 |
|
|
@@ -502,11 +503,11 @@ class AsyncAuditLogs:
|
|
| 502 |
self,
|
| 503 |
action_name: str,
|
| 504 |
*,
|
| 505 |
-
limit:
|
| 506 |
-
before:
|
| 507 |
-
after:
|
| 508 |
-
order:
|
| 509 |
-
request_options:
|
| 510 |
) -> AsyncPage[AuditLogSchema]:
|
| 511 |
"""List Schemas
|
| 512 |
|
|
@@ -552,10 +553,10 @@ class AsyncAuditLogs:
|
|
| 552 |
self,
|
| 553 |
action_name: str,
|
| 554 |
*,
|
| 555 |
-
targets:
|
| 556 |
-
actor:
|
| 557 |
-
metadata:
|
| 558 |
-
request_options:
|
| 559 |
) -> AuditLogSchema:
|
| 560 |
"""Create Schema
|
| 561 |
|
|
@@ -577,7 +578,7 @@ class AsyncAuditLogs:
|
|
| 577 |
RateLimitExceededError: If rate limited (429).
|
| 578 |
ServerError: If the server returns a 5xx error.
|
| 579 |
"""
|
| 580 |
-
body:
|
| 581 |
k: v
|
| 582 |
for k, v in {
|
| 583 |
"actor": actor.to_dict() if actor is not None else None,
|
|
@@ -599,8 +600,8 @@ class AsyncAuditLogs:
|
|
| 599 |
*,
|
| 600 |
organization_id: str,
|
| 601 |
event: AuditLogEvent,
|
| 602 |
-
idempotency_key:
|
| 603 |
-
request_options:
|
| 604 |
) -> AuditLogEventCreateResponse:
|
| 605 |
"""Create Event
|
| 606 |
|
|
@@ -629,7 +630,7 @@ class AsyncAuditLogs:
|
|
| 629 |
AuthenticationError: If the API key is invalid (401).
|
| 630 |
ServerError: If the server returns a 5xx error.
|
| 631 |
"""
|
| 632 |
-
body:
|
| 633 |
"organization_id": organization_id,
|
| 634 |
"event": event.to_dict(),
|
| 635 |
}
|
|
@@ -648,12 +649,12 @@ class AsyncAuditLogs:
|
|
| 648 |
organization_id: str,
|
| 649 |
range_start: str,
|
| 650 |
range_end: str,
|
| 651 |
-
actions:
|
| 652 |
-
actors:
|
| 653 |
-
actor_names:
|
| 654 |
-
actor_ids:
|
| 655 |
-
targets:
|
| 656 |
-
request_options:
|
| 657 |
) -> AuditLogExport:
|
| 658 |
"""Create Export
|
| 659 |
|
|
@@ -679,7 +680,7 @@ class AsyncAuditLogs:
|
|
| 679 |
RateLimitExceededError: If rate limited (429).
|
| 680 |
ServerError: If the server returns a 5xx error.
|
| 681 |
"""
|
| 682 |
-
body:
|
| 683 |
k: v
|
| 684 |
for k, v in {
|
| 685 |
"organization_id": organization_id,
|
|
@@ -705,7 +706,7 @@ class AsyncAuditLogs:
|
|
| 705 |
self,
|
| 706 |
audit_log_export_id: str,
|
| 707 |
*,
|
| 708 |
-
request_options:
|
| 709 |
) -> AuditLogExport:
|
| 710 |
"""Get Export
|
| 711 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 11 |
+
from workos.organizations.models.audit_logs_retention import AuditLogsRetention
|
| 12 |
+
|
| 13 |
+
from .._pagination import AsyncPage, SyncPage
|
| 14 |
from .._types import RequestOptions, enum_value
|
| 15 |
from .models import (
|
| 16 |
AuditLogAction,
|
|
|
|
| 21 |
AuditLogSchemaActorInput,
|
| 22 |
AuditLogSchemaTargetInput,
|
| 23 |
)
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
class AuditLogs:
|
| 27 |
"""Audit Logs API resources."""
|
| 28 |
|
| 29 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 30 |
self._client = client
|
| 31 |
|
| 32 |
def get_organization_audit_logs_retention(
|
| 33 |
self,
|
| 34 |
id: str,
|
| 35 |
*,
|
| 36 |
+
request_options: RequestOptions | None = None,
|
| 37 |
) -> AuditLogsRetention:
|
| 38 |
"""Get Retention
|
| 39 |
|
|
|
|
| 64 |
id: str,
|
| 65 |
*,
|
| 66 |
retention_period_in_days: int,
|
| 67 |
+
request_options: RequestOptions | None = None,
|
| 68 |
) -> AuditLogsRetention:
|
| 69 |
"""Set Retention
|
| 70 |
|
|
|
|
| 85 |
RateLimitExceededError: If rate limited (429).
|
| 86 |
ServerError: If the server returns a 5xx error.
|
| 87 |
"""
|
| 88 |
+
body: dict[str, Any] = {
|
| 89 |
"retention_period_in_days": retention_period_in_days,
|
| 90 |
}
|
| 91 |
return self._client.request(
|
|
|
|
| 99 |
def list_actions(
|
| 100 |
self,
|
| 101 |
*,
|
| 102 |
+
limit: int | None = None,
|
| 103 |
+
before: str | None = None,
|
| 104 |
+
after: str | None = None,
|
| 105 |
+
order: PaginationOrder | str | None = "desc",
|
| 106 |
+
request_options: RequestOptions | None = None,
|
| 107 |
) -> SyncPage[AuditLogAction]:
|
| 108 |
"""List Actions
|
| 109 |
|
|
|
|
| 148 |
self,
|
| 149 |
action_name: str,
|
| 150 |
*,
|
| 151 |
+
limit: int | None = None,
|
| 152 |
+
before: str | None = None,
|
| 153 |
+
after: str | None = None,
|
| 154 |
+
order: PaginationOrder | str | None = "desc",
|
| 155 |
+
request_options: RequestOptions | None = None,
|
| 156 |
) -> SyncPage[AuditLogSchema]:
|
| 157 |
"""List Schemas
|
| 158 |
|
|
|
|
| 198 |
self,
|
| 199 |
action_name: str,
|
| 200 |
*,
|
| 201 |
+
targets: list[AuditLogSchemaTargetInput],
|
| 202 |
+
actor: AuditLogSchemaActorInput | None = None,
|
| 203 |
+
metadata: dict[str, Any] | None = None,
|
| 204 |
+
request_options: RequestOptions | None = None,
|
| 205 |
) -> AuditLogSchema:
|
| 206 |
"""Create Schema
|
| 207 |
|
|
|
|
| 223 |
RateLimitExceededError: If rate limited (429).
|
| 224 |
ServerError: If the server returns a 5xx error.
|
| 225 |
"""
|
| 226 |
+
body: dict[str, Any] = {
|
| 227 |
k: v
|
| 228 |
for k, v in {
|
| 229 |
"actor": actor.to_dict() if actor is not None else None,
|
|
|
|
| 245 |
*,
|
| 246 |
organization_id: str,
|
| 247 |
event: AuditLogEvent,
|
| 248 |
+
idempotency_key: str | None = None,
|
| 249 |
+
request_options: RequestOptions | None = None,
|
| 250 |
) -> AuditLogEventCreateResponse:
|
| 251 |
"""Create Event
|
| 252 |
|
|
|
|
| 275 |
AuthenticationError: If the API key is invalid (401).
|
| 276 |
ServerError: If the server returns a 5xx error.
|
| 277 |
"""
|
| 278 |
+
body: dict[str, Any] = {
|
| 279 |
"organization_id": organization_id,
|
| 280 |
"event": event.to_dict(),
|
| 281 |
}
|
|
|
|
| 294 |
organization_id: str,
|
| 295 |
range_start: str,
|
| 296 |
range_end: str,
|
| 297 |
+
actions: list[str] | None = None,
|
| 298 |
+
actors: list[str] | None = None,
|
| 299 |
+
actor_names: list[str] | None = None,
|
| 300 |
+
actor_ids: list[str] | None = None,
|
| 301 |
+
targets: list[str] | None = None,
|
| 302 |
+
request_options: RequestOptions | None = None,
|
| 303 |
) -> AuditLogExport:
|
| 304 |
"""Create Export
|
| 305 |
|
|
|
|
| 325 |
RateLimitExceededError: If rate limited (429).
|
| 326 |
ServerError: If the server returns a 5xx error.
|
| 327 |
"""
|
| 328 |
+
body: dict[str, Any] = {
|
| 329 |
k: v
|
| 330 |
for k, v in {
|
| 331 |
"organization_id": organization_id,
|
|
|
|
| 351 |
self,
|
| 352 |
audit_log_export_id: str,
|
| 353 |
*,
|
| 354 |
+
request_options: RequestOptions | None = None,
|
| 355 |
) -> AuditLogExport:
|
| 356 |
"""Get Export
|
| 357 |
|
|
|
|
| 381 |
class AsyncAuditLogs:
|
| 382 |
"""Audit Logs API resources (async)."""
|
| 383 |
|
| 384 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 385 |
self._client = client
|
| 386 |
|
| 387 |
async def get_organization_audit_logs_retention(
|
| 388 |
self,
|
| 389 |
id: str,
|
| 390 |
*,
|
| 391 |
+
request_options: RequestOptions | None = None,
|
| 392 |
) -> AuditLogsRetention:
|
| 393 |
"""Get Retention
|
| 394 |
|
|
|
|
| 419 |
id: str,
|
| 420 |
*,
|
| 421 |
retention_period_in_days: int,
|
| 422 |
+
request_options: RequestOptions | None = None,
|
| 423 |
) -> AuditLogsRetention:
|
| 424 |
"""Set Retention
|
| 425 |
|
|
|
|
| 440 |
RateLimitExceededError: If rate limited (429).
|
| 441 |
ServerError: If the server returns a 5xx error.
|
| 442 |
"""
|
| 443 |
+
body: dict[str, Any] = {
|
| 444 |
"retention_period_in_days": retention_period_in_days,
|
| 445 |
}
|
| 446 |
return await self._client.request(
|
|
|
|
| 454 |
async def list_actions(
|
| 455 |
self,
|
| 456 |
*,
|
| 457 |
+
limit: int | None = None,
|
| 458 |
+
before: str | None = None,
|
| 459 |
+
after: str | None = None,
|
| 460 |
+
order: PaginationOrder | str | None = "desc",
|
| 461 |
+
request_options: RequestOptions | None = None,
|
| 462 |
) -> AsyncPage[AuditLogAction]:
|
| 463 |
"""List Actions
|
| 464 |
|
|
|
|
| 503 |
self,
|
| 504 |
action_name: str,
|
| 505 |
*,
|
| 506 |
+
limit: int | None = None,
|
| 507 |
+
before: str | None = None,
|
| 508 |
+
after: str | None = None,
|
| 509 |
+
order: PaginationOrder | str | None = "desc",
|
| 510 |
+
request_options: RequestOptions | None = None,
|
| 511 |
) -> AsyncPage[AuditLogSchema]:
|
| 512 |
"""List Schemas
|
| 513 |
|
|
|
|
| 553 |
self,
|
| 554 |
action_name: str,
|
| 555 |
*,
|
| 556 |
+
targets: list[AuditLogSchemaTargetInput],
|
| 557 |
+
actor: AuditLogSchemaActorInput | None = None,
|
| 558 |
+
metadata: dict[str, Any] | None = None,
|
| 559 |
+
request_options: RequestOptions | None = None,
|
| 560 |
) -> AuditLogSchema:
|
| 561 |
"""Create Schema
|
| 562 |
|
|
|
|
| 578 |
RateLimitExceededError: If rate limited (429).
|
| 579 |
ServerError: If the server returns a 5xx error.
|
| 580 |
"""
|
| 581 |
+
body: dict[str, Any] = {
|
| 582 |
k: v
|
| 583 |
for k, v in {
|
| 584 |
"actor": actor.to_dict() if actor is not None else None,
|
|
|
|
| 600 |
*,
|
| 601 |
organization_id: str,
|
| 602 |
event: AuditLogEvent,
|
| 603 |
+
idempotency_key: str | None = None,
|
| 604 |
+
request_options: RequestOptions | None = None,
|
| 605 |
) -> AuditLogEventCreateResponse:
|
| 606 |
"""Create Event
|
| 607 |
|
|
|
|
| 630 |
AuthenticationError: If the API key is invalid (401).
|
| 631 |
ServerError: If the server returns a 5xx error.
|
| 632 |
"""
|
| 633 |
+
body: dict[str, Any] = {
|
| 634 |
"organization_id": organization_id,
|
| 635 |
"event": event.to_dict(),
|
| 636 |
}
|
|
|
|
| 649 |
organization_id: str,
|
| 650 |
range_start: str,
|
| 651 |
range_end: str,
|
| 652 |
+
actions: list[str] | None = None,
|
| 653 |
+
actors: list[str] | None = None,
|
| 654 |
+
actor_names: list[str] | None = None,
|
| 655 |
+
actor_ids: list[str] | None = None,
|
| 656 |
+
targets: list[str] | None = None,
|
| 657 |
+
request_options: RequestOptions | None = None,
|
| 658 |
) -> AuditLogExport:
|
| 659 |
"""Create Export
|
| 660 |
|
|
|
|
| 680 |
RateLimitExceededError: If rate limited (429).
|
| 681 |
ServerError: If the server returns a 5xx error.
|
| 682 |
"""
|
| 683 |
+
body: dict[str, Any] = {
|
| 684 |
k: v
|
| 685 |
for k, v in {
|
| 686 |
"organization_id": organization_id,
|
|
|
|
| 706 |
self,
|
| 707 |
audit_log_export_id: str,
|
| 708 |
*,
|
| 709 |
+
request_options: RequestOptions | None = None,
|
| 710 |
) -> AuditLogExport:
|
| 711 |
"""Get Export
|
| 712 |
|
python/src/workos/audit_logs/models/audit_log_event.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .audit_log_event_actor import AuditLogEventActor
|
| 13 |
from .audit_log_event_context import AuditLogEventContext
|
|
@@ -22,31 +21,31 @@ class AuditLogEvent:
|
|
| 22 |
"""Identifier of what happened."""
|
| 23 |
occurred_at: datetime
|
| 24 |
"""ISO-8601 value of when the action occurred."""
|
| 25 |
-
actor:
|
| 26 |
"""The entity that performed the action."""
|
| 27 |
-
targets:
|
| 28 |
"""The resources affected by the action."""
|
| 29 |
-
context:
|
| 30 |
"""Additional context about where and how the action occurred."""
|
| 31 |
-
metadata:
|
| 32 |
"""Additional data associated with the event or entity."""
|
| 33 |
-
version:
|
| 34 |
"""What schema version the event is associated with."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
| 41 |
action=data["action"],
|
| 42 |
occurred_at=_parse_datetime(data["occurred_at"]),
|
| 43 |
-
actor=AuditLogEventActor.from_dict(cast(
|
| 44 |
targets=[
|
| 45 |
-
AuditLogEventTarget.from_dict(cast(
|
| 46 |
for item in cast(list[Any], data["targets"])
|
| 47 |
],
|
| 48 |
context=AuditLogEventContext.from_dict(
|
| 49 |
-
cast(
|
| 50 |
),
|
| 51 |
metadata=data.get("metadata"),
|
| 52 |
version=data.get("version"),
|
|
@@ -54,9 +53,9 @@ class AuditLogEvent:
|
|
| 54 |
except (KeyError, ValueError) as e:
|
| 55 |
_raise_deserialize_error("AuditLogEvent", e)
|
| 56 |
|
| 57 |
-
def to_dict(self) ->
|
| 58 |
"""Serialize to a dictionary."""
|
| 59 |
-
result:
|
| 60 |
result["action"] = self.action
|
| 61 |
result["occurred_at"] = _format_datetime(self.occurred_at)
|
| 62 |
result["actor"] = self.actor.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
|
|
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .audit_log_event_actor import AuditLogEventActor
|
| 12 |
from .audit_log_event_context import AuditLogEventContext
|
|
|
|
| 21 |
"""Identifier of what happened."""
|
| 22 |
occurred_at: datetime
|
| 23 |
"""ISO-8601 value of when the action occurred."""
|
| 24 |
+
actor: AuditLogEventActor
|
| 25 |
"""The entity that performed the action."""
|
| 26 |
+
targets: list[AuditLogEventTarget]
|
| 27 |
"""The resources affected by the action."""
|
| 28 |
+
context: AuditLogEventContext
|
| 29 |
"""Additional context about where and how the action occurred."""
|
| 30 |
+
metadata: dict[str, str | float | bool] | None = None
|
| 31 |
"""Additional data associated with the event or entity."""
|
| 32 |
+
version: int | None = None
|
| 33 |
"""What schema version the event is associated with."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogEvent:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
| 40 |
action=data["action"],
|
| 41 |
occurred_at=_parse_datetime(data["occurred_at"]),
|
| 42 |
+
actor=AuditLogEventActor.from_dict(cast(dict[str, Any], data["actor"])),
|
| 43 |
targets=[
|
| 44 |
+
AuditLogEventTarget.from_dict(cast(dict[str, Any], item))
|
| 45 |
for item in cast(list[Any], data["targets"])
|
| 46 |
],
|
| 47 |
context=AuditLogEventContext.from_dict(
|
| 48 |
+
cast(dict[str, Any], data["context"])
|
| 49 |
),
|
| 50 |
metadata=data.get("metadata"),
|
| 51 |
version=data.get("version"),
|
|
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("AuditLogEvent", e)
|
| 55 |
|
| 56 |
+
def to_dict(self) -> dict[str, Any]:
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
+
result: dict[str, Any] = {}
|
| 59 |
result["action"] = self.action
|
| 60 |
result["occurred_at"] = _format_datetime(self.occurred_at)
|
| 61 |
result["actor"] = self.actor.to_dict()
|
python/src/workos/audit_logs/models/audit_log_event_actor.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,13 +16,13 @@ class AuditLogEventActor:
|
|
| 15 |
"""Actor identifier."""
|
| 16 |
type: str
|
| 17 |
"""Actor type."""
|
| 18 |
-
name:
|
| 19 |
"""Optional actor name."""
|
| 20 |
-
metadata:
|
| 21 |
"""Additional data associated with the event or entity."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class AuditLogEventActor:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("AuditLogEventActor", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["id"] = self.id
|
| 40 |
result["type"] = self.type
|
| 41 |
if self.name is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Actor identifier."""
|
| 17 |
type: str
|
| 18 |
"""Actor type."""
|
| 19 |
+
name: str | None = None
|
| 20 |
"""Optional actor name."""
|
| 21 |
+
metadata: dict[str, str | float | bool] | None = None
|
| 22 |
"""Additional data associated with the event or entity."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogEventActor:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("AuditLogEventActor", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["id"] = self.id
|
| 41 |
result["type"] = self.type
|
| 42 |
if self.name is not None:
|
python/src/workos/audit_logs/models/audit_log_event_context.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,11 +14,11 @@ class AuditLogEventContext:
|
|
| 13 |
|
| 14 |
location: str
|
| 15 |
"""IP Address or some other geolocation identifier."""
|
| 16 |
-
user_agent:
|
| 17 |
"""User agent string."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class AuditLogEventContext:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("AuditLogEventContext", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["location"] = self.location
|
| 34 |
if self.user_agent is not None:
|
| 35 |
result["user_agent"] = self.user_agent
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
location: str
|
| 16 |
"""IP Address or some other geolocation identifier."""
|
| 17 |
+
user_agent: str | None = None
|
| 18 |
"""User agent string."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogEventContext:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("AuditLogEventContext", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["location"] = self.location
|
| 35 |
if self.user_agent is not None:
|
| 36 |
result["user_agent"] = self.user_agent
|
python/src/workos/audit_logs/models/audit_log_event_create_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AuditLogEventCreateResponse:
|
|
| 15 |
"""Whether the Audit Log event was created successfully."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AuditLogEventCreateResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuditLogEventCreateResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["success"] = self.success
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Whether the Audit Log event was created successfully."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogEventCreateResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuditLogEventCreateResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["success"] = self.success
|
| 32 |
return result
|
python/src/workos/audit_logs/models/audit_log_export.py|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
from workos.common.models.audit_log_export_state import AuditLogExportState
|
| 12 |
|
| 13 |
|
|
@@ -19,17 +19,17 @@ class AuditLogExport:
|
|
| 19 |
"""Distinguishes the Audit Log Export object."""
|
| 20 |
id: str
|
| 21 |
"""The unique ID of the Audit Log Export."""
|
| 22 |
-
state:
|
| 23 |
"""The state of the export. Possible values: pending, ready, error, expired."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
updated_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
-
url:
|
| 29 |
"""A URL to the CSV file. Only defined when the Audit Log Export is ready."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -43,9 +43,9 @@ class AuditLogExport:
|
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("AuditLogExport", e)
|
| 45 |
|
| 46 |
-
def to_dict(self) ->
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
-
result:
|
| 49 |
result["object"] = self.object
|
| 50 |
result["id"] = self.id
|
| 51 |
result["state"] = (
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.audit_log_export_state import AuditLogExportState
|
| 12 |
|
| 13 |
|
|
|
|
| 19 |
"""Distinguishes the Audit Log Export object."""
|
| 20 |
id: str
|
| 21 |
"""The unique ID of the Audit Log Export."""
|
| 22 |
+
state: AuditLogExportState
|
| 23 |
"""The state of the export. Possible values: pending, ready, error, expired."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
updated_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
url: str | None = None
|
| 29 |
"""A URL to the CSV file. Only defined when the Audit Log Export is ready."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogExport:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("AuditLogExport", e)
|
| 45 |
|
| 46 |
+
def to_dict(self) -> dict[str, Any]:
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
+
result: dict[str, Any] = {}
|
| 49 |
result["object"] = self.object
|
| 50 |
result["id"] = self.id
|
| 51 |
result["state"] = (
|
python/src/workos/audit_logs/models/audit_log_export_creation.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -19,21 +19,21 @@ class AuditLogExportCreation:
|
|
| 19 |
"""ISO-8601 value for start of the export range."""
|
| 20 |
range_end: datetime
|
| 21 |
"""ISO-8601 value for end of the export range."""
|
| 22 |
-
actions:
|
| 23 |
"""List of actions to filter against."""
|
| 24 |
-
actors:
|
| 25 |
"""Deprecated. Use `actor_names` instead.
|
| 26 |
|
| 27 |
.. deprecated:: This field is deprecated."""
|
| 28 |
-
actor_names:
|
| 29 |
"""List of actor names to filter against."""
|
| 30 |
-
actor_ids:
|
| 31 |
"""List of actor IDs to filter against."""
|
| 32 |
-
targets:
|
| 33 |
"""List of target types to filter against."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -49,9 +49,9 @@ class AuditLogExportCreation:
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuditLogExportCreation", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["organization_id"] = self.organization_id
|
| 56 |
result["range_start"] = _format_datetime(self.range_start)
|
| 57 |
result["range_end"] = _format_datetime(self.range_end)
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 19 |
"""ISO-8601 value for start of the export range."""
|
| 20 |
range_end: datetime
|
| 21 |
"""ISO-8601 value for end of the export range."""
|
| 22 |
+
actions: list[str] | None = None
|
| 23 |
"""List of actions to filter against."""
|
| 24 |
+
actors: list[str] | None = None
|
| 25 |
"""Deprecated. Use `actor_names` instead.
|
| 26 |
|
| 27 |
.. deprecated:: This field is deprecated."""
|
| 28 |
+
actor_names: list[str] | None = None
|
| 29 |
"""List of actor names to filter against."""
|
| 30 |
+
actor_ids: list[str] | None = None
|
| 31 |
"""List of actor IDs to filter against."""
|
| 32 |
+
targets: list[str] | None = None
|
| 33 |
"""List of target types to filter against."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogExportCreation:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuditLogExportCreation", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["organization_id"] = self.organization_id
|
| 56 |
result["range_start"] = _format_datetime(self.range_start)
|
| 57 |
result["range_end"] = _format_datetime(self.range_end)
|
python/src/workos/audit_logs/models/audit_log_schema.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .audit_log_schema_actor import AuditLogSchemaActor
|
| 13 |
from .audit_log_schema_target import AuditLogSchemaTarget
|
|
@@ -21,28 +20,28 @@ class AuditLogSchema:
|
|
| 21 |
"""Distinguishes the Audit Log Schema object."""
|
| 22 |
version: int
|
| 23 |
"""The version of the schema."""
|
| 24 |
-
targets:
|
| 25 |
"""The list of targets for the schema."""
|
| 26 |
created_at: datetime
|
| 27 |
"""The timestamp when the Audit Log Schema was created."""
|
| 28 |
-
actor:
|
| 29 |
"""The metadata schema for the actor."""
|
| 30 |
-
metadata:
|
| 31 |
"""Additional data associated with the event or entity."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
| 38 |
object=data.get("object", "audit_log_schema"),
|
| 39 |
version=data["version"],
|
| 40 |
targets=[
|
| 41 |
-
AuditLogSchemaTarget.from_dict(cast(
|
| 42 |
for item in cast(list[Any], data["targets"])
|
| 43 |
],
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
actor=AuditLogSchemaActor.from_dict(cast(
|
| 46 |
if (_v_actor := data.get("actor")) is not None
|
| 47 |
else None,
|
| 48 |
metadata=data.get("metadata"),
|
|
@@ -50,9 +49,9 @@ class AuditLogSchema:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("AuditLogSchema", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["version"] = self.version
|
| 58 |
result["targets"] = [item.to_dict() for item in self.targets]
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .audit_log_schema_actor import AuditLogSchemaActor
|
| 12 |
from .audit_log_schema_target import AuditLogSchemaTarget
|
|
|
|
| 20 |
"""Distinguishes the Audit Log Schema object."""
|
| 21 |
version: int
|
| 22 |
"""The version of the schema."""
|
| 23 |
+
targets: list[AuditLogSchemaTarget]
|
| 24 |
"""The list of targets for the schema."""
|
| 25 |
created_at: datetime
|
| 26 |
"""The timestamp when the Audit Log Schema was created."""
|
| 27 |
+
actor: AuditLogSchemaActor | None = None
|
| 28 |
"""The metadata schema for the actor."""
|
| 29 |
+
metadata: dict[str, Any] | None = None
|
| 30 |
"""Additional data associated with the event or entity."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogSchema:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
object=data.get("object", "audit_log_schema"),
|
| 38 |
version=data["version"],
|
| 39 |
targets=[
|
| 40 |
+
AuditLogSchemaTarget.from_dict(cast(dict[str, Any], item))
|
| 41 |
for item in cast(list[Any], data["targets"])
|
| 42 |
],
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
actor=AuditLogSchemaActor.from_dict(cast(dict[str, Any], _v_actor))
|
| 45 |
if (_v_actor := data.get("actor")) is not None
|
| 46 |
else None,
|
| 47 |
metadata=data.get("metadata"),
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuditLogSchema", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["object"] = self.object
|
| 56 |
result["version"] = self.version
|
| 57 |
result["targets"] = [item.to_dict() for item in self.targets]
|
python/src/workos/audit_logs/models/audit_log_schema_actor.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class AuditLogSchemaActor:
|
| 12 |
"""The metadata schema for the actor."""
|
| 13 |
|
| 14 |
-
metadata:
|
| 15 |
"""The JSON Schema definition for actor metadata."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AuditLogSchemaActor:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuditLogSchemaActor", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["metadata"] = self.metadata
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class AuditLogSchemaActor:
|
| 13 |
"""The metadata schema for the actor."""
|
| 14 |
|
| 15 |
+
metadata: dict[str, Any]
|
| 16 |
"""The JSON Schema definition for actor metadata."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogSchemaActor:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuditLogSchemaActor", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["metadata"] = self.metadata
|
| 32 |
return result
|
python/src/workos/audit_logs/models/audit_log_schema_input.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .audit_log_schema_actor_input import AuditLogSchemaActorInput
|
|
@@ -15,23 +15,23 @@ from .audit_log_schema_target_input import AuditLogSchemaTargetInput
|
|
| 15 |
class AuditLogSchemaInput:
|
| 16 |
"""Audit Log Schema Input model."""
|
| 17 |
|
| 18 |
-
targets:
|
| 19 |
"""The list of targets for the schema."""
|
| 20 |
-
actor:
|
| 21 |
"""The metadata schema for the actor."""
|
| 22 |
-
metadata:
|
| 23 |
"""Optional JSON schema for event metadata."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
targets=[
|
| 31 |
-
AuditLogSchemaTargetInput.from_dict(cast(
|
| 32 |
for item in cast(list[Any], data["targets"])
|
| 33 |
],
|
| 34 |
-
actor=AuditLogSchemaActorInput.from_dict(cast(
|
| 35 |
if (_v_actor := data.get("actor")) is not None
|
| 36 |
else None,
|
| 37 |
metadata=data.get("metadata"),
|
|
@@ -39,9 +39,9 @@ class AuditLogSchemaInput:
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("AuditLogSchemaInput", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["targets"] = [item.to_dict() for item in self.targets]
|
| 46 |
if self.actor is not None:
|
| 47 |
result["actor"] = self.actor.to_dict()
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .audit_log_schema_actor_input import AuditLogSchemaActorInput
|
|
|
|
| 15 |
class AuditLogSchemaInput:
|
| 16 |
"""Audit Log Schema Input model."""
|
| 17 |
|
| 18 |
+
targets: list[AuditLogSchemaTargetInput]
|
| 19 |
"""The list of targets for the schema."""
|
| 20 |
+
actor: AuditLogSchemaActorInput | None = None
|
| 21 |
"""The metadata schema for the actor."""
|
| 22 |
+
metadata: dict[str, Any] | None = None
|
| 23 |
"""Optional JSON schema for event metadata."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogSchemaInput:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
targets=[
|
| 31 |
+
AuditLogSchemaTargetInput.from_dict(cast(dict[str, Any], item))
|
| 32 |
for item in cast(list[Any], data["targets"])
|
| 33 |
],
|
| 34 |
+
actor=AuditLogSchemaActorInput.from_dict(cast(dict[str, Any], _v_actor))
|
| 35 |
if (_v_actor := data.get("actor")) is not None
|
| 36 |
else None,
|
| 37 |
metadata=data.get("metadata"),
|
|
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("AuditLogSchemaInput", e)
|
| 41 |
|
| 42 |
+
def to_dict(self) -> dict[str, Any]:
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
+
result: dict[str, Any] = {}
|
| 45 |
result["targets"] = [item.to_dict() for item in self.targets]
|
| 46 |
if self.actor is not None:
|
| 47 |
result["actor"] = self.actor.to_dict()
|
python/src/workos/audit_logs/models/audit_log_schema_target.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,11 +14,11 @@ class AuditLogSchemaTarget:
|
|
| 13 |
|
| 14 |
type: str
|
| 15 |
"""The type of the target resource."""
|
| 16 |
-
metadata:
|
| 17 |
"""Additional data associated with the event or entity."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class AuditLogSchemaTarget:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("AuditLogSchemaTarget", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["type"] = self.type
|
| 34 |
if self.metadata is not None:
|
| 35 |
result["metadata"] = self.metadata
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: str
|
| 16 |
"""The type of the target resource."""
|
| 17 |
+
metadata: dict[str, Any] | None = None
|
| 18 |
"""Additional data associated with the event or entity."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogSchemaTarget:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("AuditLogSchemaTarget", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["type"] = self.type
|
| 35 |
if self.metadata is not None:
|
| 36 |
result["metadata"] = self.metadata
|
python/src/workos/authorization/_resource.py|
@@ -2,13 +2,23 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
-
from .._types import
|
| 11 |
from .models import (
|
|
|
|
| 12 |
AuthorizationCheck,
|
| 13 |
AuthorizationResource,
|
| 14 |
GroupRoleAssignment,
|
|
@@ -19,14 +29,6 @@ from .models import (
|
|
| 19 |
RoleList,
|
| 20 |
UserRoleAssignment,
|
| 21 |
)
|
| 22 |
-
from workos.common.models.authorization_permission import AuthorizationPermission
|
| 23 |
-
from workos.common.models.user_organization_membership_base_list_data import (
|
| 24 |
-
UserOrganizationMembershipBaseListData,
|
| 25 |
-
)
|
| 26 |
-
from .models import AuthorizationAssignment
|
| 27 |
-
from workos.common.models.pagination_order import PaginationOrder
|
| 28 |
-
from .._pagination import AsyncPage, SyncPage
|
| 29 |
-
from dataclasses import dataclass
|
| 30 |
|
| 31 |
|
| 32 |
@dataclass
|
|
@@ -77,18 +79,18 @@ class ParentByExternalId:
|
|
| 77 |
class Authorization:
|
| 78 |
"""Authorization API resources."""
|
| 79 |
|
| 80 |
-
def __init__(self, client:
|
| 81 |
self._client = client
|
| 82 |
|
| 83 |
def list_group_role_assignments(
|
| 84 |
self,
|
| 85 |
group_id: str,
|
| 86 |
*,
|
| 87 |
-
limit:
|
| 88 |
-
before:
|
| 89 |
-
after:
|
| 90 |
-
order:
|
| 91 |
-
request_options:
|
| 92 |
) -> SyncPage[GroupRoleAssignment]:
|
| 93 |
"""List role assignments for a group
|
| 94 |
|
|
@@ -135,10 +137,10 @@ class Authorization:
|
|
| 135 |
group_id: str,
|
| 136 |
*,
|
| 137 |
role_slug: str,
|
| 138 |
-
resource_id:
|
| 139 |
-
resource_external_id:
|
| 140 |
-
resource_type_slug:
|
| 141 |
-
request_options:
|
| 142 |
) -> GroupRoleAssignment:
|
| 143 |
"""Assign a role to a group
|
| 144 |
|
|
@@ -164,7 +166,7 @@ class Authorization:
|
|
| 164 |
RateLimitExceededError: If rate limited (429).
|
| 165 |
ServerError: If the server returns a 5xx error.
|
| 166 |
"""
|
| 167 |
-
body:
|
| 168 |
k: v
|
| 169 |
for k, v in {
|
| 170 |
"role_slug": role_slug,
|
|
@@ -186,8 +188,8 @@ class Authorization:
|
|
| 186 |
self,
|
| 187 |
group_id: str,
|
| 188 |
*,
|
| 189 |
-
role_assignments:
|
| 190 |
-
request_options:
|
| 191 |
) -> GroupRoleAssignmentList:
|
| 192 |
"""Replace all role assignments for a group
|
| 193 |
|
|
@@ -209,7 +211,7 @@ class Authorization:
|
|
| 209 |
RateLimitExceededError: If rate limited (429).
|
| 210 |
ServerError: If the server returns a 5xx error.
|
| 211 |
"""
|
| 212 |
-
body:
|
| 213 |
"role_assignments": [item.to_dict() for item in role_assignments],
|
| 214 |
}
|
| 215 |
return self._client.request(
|
|
@@ -225,10 +227,10 @@ class Authorization:
|
|
| 225 |
group_id: str,
|
| 226 |
*,
|
| 227 |
role_slug: str,
|
| 228 |
-
resource_id:
|
| 229 |
-
resource_external_id:
|
| 230 |
-
resource_type_slug:
|
| 231 |
-
request_options:
|
| 232 |
) -> None:
|
| 233 |
"""Remove group role assignments by criteria
|
| 234 |
|
|
@@ -250,7 +252,7 @@ class Authorization:
|
|
| 250 |
RateLimitExceededError: If rate limited (429).
|
| 251 |
ServerError: If the server returns a 5xx error.
|
| 252 |
"""
|
| 253 |
-
body:
|
| 254 |
k: v
|
| 255 |
for k, v in {
|
| 256 |
"role_slug": role_slug,
|
|
@@ -272,7 +274,7 @@ class Authorization:
|
|
| 272 |
group_id: str,
|
| 273 |
role_assignment_id: str,
|
| 274 |
*,
|
| 275 |
-
request_options:
|
| 276 |
) -> GroupRoleAssignment:
|
| 277 |
"""Get a group role assignment
|
| 278 |
|
|
@@ -311,7 +313,7 @@ class Authorization:
|
|
| 311 |
group_id: str,
|
| 312 |
role_assignment_id: str,
|
| 313 |
*,
|
| 314 |
-
request_options:
|
| 315 |
) -> None:
|
| 316 |
"""Remove a group role assignment
|
| 317 |
|
|
@@ -346,8 +348,8 @@ class Authorization:
|
|
| 346 |
organization_membership_id: str,
|
| 347 |
*,
|
| 348 |
permission_slug: str,
|
| 349 |
-
resource_target:
|
| 350 |
-
request_options:
|
| 351 |
) -> AuthorizationCheck:
|
| 352 |
"""Check authorization
|
| 353 |
|
|
@@ -370,7 +372,7 @@ class Authorization:
|
|
| 370 |
RateLimitExceededError: If rate limited (429).
|
| 371 |
ServerError: If the server returns a 5xx error.
|
| 372 |
"""
|
| 373 |
-
body:
|
| 374 |
"permission_slug": permission_slug,
|
| 375 |
}
|
| 376 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -395,13 +397,13 @@ class Authorization:
|
|
| 395 |
self,
|
| 396 |
organization_membership_id: str,
|
| 397 |
*,
|
| 398 |
-
limit:
|
| 399 |
-
before:
|
| 400 |
-
after:
|
| 401 |
-
order:
|
| 402 |
permission_slug: str,
|
| 403 |
-
parent_resource:
|
| 404 |
-
request_options:
|
| 405 |
) -> SyncPage[AuthorizationResource]:
|
| 406 |
"""List resources for organization membership
|
| 407 |
|
|
@@ -469,11 +471,11 @@ class Authorization:
|
|
| 469 |
organization_membership_id: str,
|
| 470 |
resource_id: str,
|
| 471 |
*,
|
| 472 |
-
limit:
|
| 473 |
-
before:
|
| 474 |
-
after:
|
| 475 |
-
order:
|
| 476 |
-
request_options:
|
| 477 |
) -> SyncPage[AuthorizationPermission]:
|
| 478 |
"""List effective permissions for an organization membership on a resource
|
| 479 |
|
|
@@ -530,11 +532,11 @@ class Authorization:
|
|
| 530 |
resource_type_slug: str,
|
| 531 |
external_id: str,
|
| 532 |
*,
|
| 533 |
-
limit:
|
| 534 |
-
before:
|
| 535 |
-
after:
|
| 536 |
-
order:
|
| 537 |
-
request_options:
|
| 538 |
) -> SyncPage[AuthorizationPermission]:
|
| 539 |
"""List effective permissions for an organization membership on a resource by external ID
|
| 540 |
|
|
@@ -591,14 +593,14 @@ class Authorization:
|
|
| 591 |
self,
|
| 592 |
organization_membership_id: str,
|
| 593 |
*,
|
| 594 |
-
limit:
|
| 595 |
-
before:
|
| 596 |
-
after:
|
| 597 |
-
order:
|
| 598 |
-
resource_id:
|
| 599 |
-
resource_external_id:
|
| 600 |
-
resource_type_slug:
|
| 601 |
-
request_options:
|
| 602 |
) -> SyncPage[UserRoleAssignment]:
|
| 603 |
"""List role assignments
|
| 604 |
|
|
@@ -656,8 +658,8 @@ class Authorization:
|
|
| 656 |
organization_membership_id: str,
|
| 657 |
*,
|
| 658 |
role_slug: str,
|
| 659 |
-
resource_target:
|
| 660 |
-
request_options:
|
| 661 |
) -> UserRoleAssignment:
|
| 662 |
"""Assign a role
|
| 663 |
|
|
@@ -680,7 +682,7 @@ class Authorization:
|
|
| 680 |
RateLimitExceededError: If rate limited (429).
|
| 681 |
ServerError: If the server returns a 5xx error.
|
| 682 |
"""
|
| 683 |
-
body:
|
| 684 |
"role_slug": role_slug,
|
| 685 |
}
|
| 686 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -706,8 +708,8 @@ class Authorization:
|
|
| 706 |
organization_membership_id: str,
|
| 707 |
*,
|
| 708 |
role_slug: str,
|
| 709 |
-
resource_target:
|
| 710 |
-
request_options:
|
| 711 |
) -> None:
|
| 712 |
"""Remove a role assignment
|
| 713 |
|
|
@@ -727,7 +729,7 @@ class Authorization:
|
|
| 727 |
RateLimitExceededError: If rate limited (429).
|
| 728 |
ServerError: If the server returns a 5xx error.
|
| 729 |
"""
|
| 730 |
-
body:
|
| 731 |
"role_slug": role_slug,
|
| 732 |
}
|
| 733 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -752,7 +754,7 @@ class Authorization:
|
|
| 752 |
organization_membership_id: str,
|
| 753 |
role_assignment_id: str,
|
| 754 |
*,
|
| 755 |
-
request_options:
|
| 756 |
) -> None:
|
| 757 |
"""Remove a role assignment by ID
|
| 758 |
|
|
@@ -786,7 +788,7 @@ class Authorization:
|
|
| 786 |
self,
|
| 787 |
organization_id: str,
|
| 788 |
*,
|
| 789 |
-
request_options:
|
| 790 |
) -> RoleList:
|
| 791 |
"""List custom roles
|
| 792 |
|
|
@@ -818,10 +820,10 @@ class Authorization:
|
|
| 818 |
organization_id: str,
|
| 819 |
*,
|
| 820 |
name: str,
|
| 821 |
-
slug:
|
| 822 |
-
description:
|
| 823 |
-
resource_type_slug:
|
| 824 |
-
request_options:
|
| 825 |
) -> Role:
|
| 826 |
"""Create a custom role
|
| 827 |
|
|
@@ -848,7 +850,7 @@ class Authorization:
|
|
| 848 |
RateLimitExceededError: If rate limited (429).
|
| 849 |
ServerError: If the server returns a 5xx error.
|
| 850 |
"""
|
| 851 |
-
body:
|
| 852 |
k: v
|
| 853 |
for k, v in {
|
| 854 |
"slug": slug,
|
|
@@ -872,7 +874,7 @@ class Authorization:
|
|
| 872 |
organization_id: str,
|
| 873 |
slug: str,
|
| 874 |
*,
|
| 875 |
-
request_options:
|
| 876 |
) -> Role:
|
| 877 |
"""Get a custom role
|
| 878 |
|
|
@@ -911,9 +913,9 @@ class Authorization:
|
|
| 911 |
organization_id: str,
|
| 912 |
slug: str,
|
| 913 |
*,
|
| 914 |
-
name:
|
| 915 |
-
description:
|
| 916 |
-
request_options:
|
| 917 |
) -> Role:
|
| 918 |
"""Update a custom role
|
| 919 |
|
|
@@ -938,7 +940,7 @@ class Authorization:
|
|
| 938 |
RateLimitExceededError: If rate limited (429).
|
| 939 |
ServerError: If the server returns a 5xx error.
|
| 940 |
"""
|
| 941 |
-
body:
|
| 942 |
k: v
|
| 943 |
for k, v in {
|
| 944 |
"name": name,
|
|
@@ -966,7 +968,7 @@ class Authorization:
|
|
| 966 |
organization_id: str,
|
| 967 |
slug: str,
|
| 968 |
*,
|
| 969 |
-
request_options:
|
| 970 |
) -> None:
|
| 971 |
"""Delete a custom role
|
| 972 |
|
|
@@ -1004,7 +1006,7 @@ class Authorization:
|
|
| 1004 |
slug: str,
|
| 1005 |
*,
|
| 1006 |
body_slug: str,
|
| 1007 |
-
request_options:
|
| 1008 |
) -> Role:
|
| 1009 |
"""Add a permission to a custom role
|
| 1010 |
|
|
@@ -1028,7 +1030,7 @@ class Authorization:
|
|
| 1028 |
RateLimitExceededError: If rate limited (429).
|
| 1029 |
ServerError: If the server returns a 5xx error.
|
| 1030 |
"""
|
| 1031 |
-
body:
|
| 1032 |
"slug": body_slug,
|
| 1033 |
}
|
| 1034 |
return self._client.request(
|
|
@@ -1051,8 +1053,8 @@ class Authorization:
|
|
| 1051 |
organization_id: str,
|
| 1052 |
slug: str,
|
| 1053 |
*,
|
| 1054 |
-
permissions:
|
| 1055 |
-
request_options:
|
| 1056 |
) -> Role:
|
| 1057 |
"""Set permissions for a custom role
|
| 1058 |
|
|
@@ -1075,7 +1077,7 @@ class Authorization:
|
|
| 1075 |
RateLimitExceededError: If rate limited (429).
|
| 1076 |
ServerError: If the server returns a 5xx error.
|
| 1077 |
"""
|
| 1078 |
-
body:
|
| 1079 |
"permissions": permissions,
|
| 1080 |
}
|
| 1081 |
return self._client.request(
|
|
@@ -1099,7 +1101,7 @@ class Authorization:
|
|
| 1099 |
slug: str,
|
| 1100 |
permission_slug: str,
|
| 1101 |
*,
|
| 1102 |
-
request_options:
|
| 1103 |
) -> None:
|
| 1104 |
"""Remove a permission from a custom role
|
| 1105 |
|
|
@@ -1138,7 +1140,7 @@ class Authorization:
|
|
| 1138 |
resource_type_slug: str,
|
| 1139 |
external_id: str,
|
| 1140 |
*,
|
| 1141 |
-
request_options:
|
| 1142 |
) -> AuthorizationResource:
|
| 1143 |
"""Get a resource by external ID
|
| 1144 |
|
|
@@ -1180,12 +1182,10 @@ class Authorization:
|
|
| 1180 |
resource_type_slug: str,
|
| 1181 |
external_id: str,
|
| 1182 |
*,
|
| 1183 |
-
name:
|
| 1184 |
-
description:
|
| 1185 |
-
parent_resource: Optional[
|
| 1186 |
-
|
| 1187 |
-
] = None,
|
| 1188 |
-
request_options:
|
| 1189 |
) -> AuthorizationResource:
|
| 1190 |
"""Update a resource by external ID
|
| 1191 |
|
|
@@ -1213,7 +1213,7 @@ class Authorization:
|
|
| 1213 |
RateLimitExceededError: If rate limited (429).
|
| 1214 |
ServerError: If the server returns a 5xx error.
|
| 1215 |
"""
|
| 1216 |
-
body:
|
| 1217 |
k: v
|
| 1218 |
for k, v in {
|
| 1219 |
"name": name,
|
|
@@ -1253,8 +1253,8 @@ class Authorization:
|
|
| 1253 |
resource_type_slug: str,
|
| 1254 |
external_id: str,
|
| 1255 |
*,
|
| 1256 |
-
cascade_delete:
|
| 1257 |
-
request_options:
|
| 1258 |
) -> None:
|
| 1259 |
"""Delete an authorization resource by external ID
|
| 1260 |
|
|
@@ -1276,7 +1276,7 @@ class Authorization:
|
|
| 1276 |
RateLimitExceededError: If rate limited (429).
|
| 1277 |
ServerError: If the server returns a 5xx error.
|
| 1278 |
"""
|
| 1279 |
-
params:
|
| 1280 |
k: v
|
| 1281 |
for k, v in {
|
| 1282 |
"cascade_delete": cascade_delete,
|
|
@@ -1303,13 +1303,13 @@ class Authorization:
|
|
| 1303 |
resource_type_slug: str,
|
| 1304 |
external_id: str,
|
| 1305 |
*,
|
| 1306 |
-
limit:
|
| 1307 |
-
before:
|
| 1308 |
-
after:
|
| 1309 |
-
order:
|
| 1310 |
permission_slug: str,
|
| 1311 |
-
assignment:
|
| 1312 |
-
request_options:
|
| 1313 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 1314 |
"""List memberships for a resource by external ID
|
| 1315 |
|
|
@@ -1375,12 +1375,12 @@ class Authorization:
|
|
| 1375 |
resource_type_slug: str,
|
| 1376 |
external_id: str,
|
| 1377 |
*,
|
| 1378 |
-
limit:
|
| 1379 |
-
before:
|
| 1380 |
-
after:
|
| 1381 |
-
order:
|
| 1382 |
-
role_slug:
|
| 1383 |
-
request_options:
|
| 1384 |
) -> SyncPage[UserRoleAssignment]:
|
| 1385 |
"""List role assignments for a resource by external ID
|
| 1386 |
|
|
@@ -1437,15 +1437,15 @@ class Authorization:
|
|
| 1437 |
def list_resources(
|
| 1438 |
self,
|
| 1439 |
*,
|
| 1440 |
-
limit:
|
| 1441 |
-
before:
|
| 1442 |
-
after:
|
| 1443 |
-
order:
|
| 1444 |
-
organization_id:
|
| 1445 |
-
resource_type_slug:
|
| 1446 |
-
resource_external_id:
|
| 1447 |
-
parent:
|
| 1448 |
-
request_options:
|
| 1449 |
) -> SyncPage[AuthorizationResource]:
|
| 1450 |
"""List resources
|
| 1451 |
|
|
@@ -1507,11 +1507,9 @@ class Authorization:
|
|
| 1507 |
name: str,
|
| 1508 |
resource_type_slug: str,
|
| 1509 |
organization_id: str,
|
| 1510 |
-
description:
|
| 1511 |
-
parent_resource: Optional[
|
| 1512 |
-
|
| 1513 |
-
] = None,
|
| 1514 |
-
request_options:
|
| 1515 |
) -> AuthorizationResource:
|
| 1516 |
"""Create an authorization resource
|
| 1517 |
|
|
@@ -1539,7 +1537,7 @@ class Authorization:
|
|
| 1539 |
RateLimitExceededError: If rate limited (429).
|
| 1540 |
ServerError: If the server returns a 5xx error.
|
| 1541 |
"""
|
| 1542 |
-
body:
|
| 1543 |
"external_id": external_id,
|
| 1544 |
"name": name,
|
| 1545 |
"resource_type_slug": resource_type_slug,
|
|
@@ -1569,7 +1567,7 @@ class Authorization:
|
|
| 1569 |
self,
|
| 1570 |
resource_id: str,
|
| 1571 |
*,
|
| 1572 |
-
request_options:
|
| 1573 |
) -> AuthorizationResource:
|
| 1574 |
"""Get a resource
|
| 1575 |
|
|
@@ -1601,12 +1599,10 @@ class Authorization:
|
|
| 1601 |
self,
|
| 1602 |
resource_id: str,
|
| 1603 |
*,
|
| 1604 |
-
name:
|
| 1605 |
-
description:
|
| 1606 |
-
parent_resource: Optional[
|
| 1607 |
-
|
| 1608 |
-
] = None,
|
| 1609 |
-
request_options:
|
| 1610 |
) -> AuthorizationResource:
|
| 1611 |
"""Update a resource
|
| 1612 |
|
|
@@ -1632,7 +1628,7 @@ class Authorization:
|
|
| 1632 |
RateLimitExceededError: If rate limited (429).
|
| 1633 |
ServerError: If the server returns a 5xx error.
|
| 1634 |
"""
|
| 1635 |
-
body:
|
| 1636 |
k: v
|
| 1637 |
for k, v in {
|
| 1638 |
"name": name,
|
|
@@ -1663,8 +1659,8 @@ class Authorization:
|
|
| 1663 |
self,
|
| 1664 |
resource_id: str,
|
| 1665 |
*,
|
| 1666 |
-
cascade_delete:
|
| 1667 |
-
request_options:
|
| 1668 |
) -> None:
|
| 1669 |
"""Delete an authorization resource
|
| 1670 |
|
|
@@ -1684,7 +1680,7 @@ class Authorization:
|
|
| 1684 |
RateLimitExceededError: If rate limited (429).
|
| 1685 |
ServerError: If the server returns a 5xx error.
|
| 1686 |
"""
|
| 1687 |
-
params:
|
| 1688 |
k: v
|
| 1689 |
for k, v in {
|
| 1690 |
"cascade_delete": cascade_delete,
|
|
@@ -1702,13 +1698,13 @@ class Authorization:
|
|
| 1702 |
self,
|
| 1703 |
resource_id: str,
|
| 1704 |
*,
|
| 1705 |
-
limit:
|
| 1706 |
-
before:
|
| 1707 |
-
after:
|
| 1708 |
-
order:
|
| 1709 |
permission_slug: str,
|
| 1710 |
-
assignment:
|
| 1711 |
-
request_options:
|
| 1712 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 1713 |
"""List organization memberships for resource
|
| 1714 |
|
|
@@ -1767,12 +1763,12 @@ class Authorization:
|
|
| 1767 |
self,
|
| 1768 |
resource_id: str,
|
| 1769 |
*,
|
| 1770 |
-
limit:
|
| 1771 |
-
before:
|
| 1772 |
-
after:
|
| 1773 |
-
order:
|
| 1774 |
-
role_slug:
|
| 1775 |
-
request_options:
|
| 1776 |
) -> SyncPage[UserRoleAssignment]:
|
| 1777 |
"""List role assignments for a resource
|
| 1778 |
|
|
@@ -1819,7 +1815,7 @@ class Authorization:
|
|
| 1819 |
def list_environment_roles(
|
| 1820 |
self,
|
| 1821 |
*,
|
| 1822 |
-
request_options:
|
| 1823 |
) -> RoleList:
|
| 1824 |
"""List environment roles
|
| 1825 |
|
|
@@ -1846,9 +1842,9 @@ class Authorization:
|
|
| 1846 |
*,
|
| 1847 |
slug: str,
|
| 1848 |
name: str,
|
| 1849 |
-
description:
|
| 1850 |
-
resource_type_slug:
|
| 1851 |
-
request_options:
|
| 1852 |
) -> Role:
|
| 1853 |
"""Create an environment role
|
| 1854 |
|
|
@@ -1874,7 +1870,7 @@ class Authorization:
|
|
| 1874 |
RateLimitExceededError: If rate limited (429).
|
| 1875 |
ServerError: If the server returns a 5xx error.
|
| 1876 |
"""
|
| 1877 |
-
body:
|
| 1878 |
k: v
|
| 1879 |
for k, v in {
|
| 1880 |
"slug": slug,
|
|
@@ -1897,7 +1893,7 @@ class Authorization:
|
|
| 1897 |
self,
|
| 1898 |
slug: str,
|
| 1899 |
*,
|
| 1900 |
-
request_options:
|
| 1901 |
) -> Role:
|
| 1902 |
"""Get an environment role
|
| 1903 |
|
|
@@ -1928,9 +1924,9 @@ class Authorization:
|
|
| 1928 |
self,
|
| 1929 |
slug: str,
|
| 1930 |
*,
|
| 1931 |
-
name:
|
| 1932 |
-
description:
|
| 1933 |
-
request_options:
|
| 1934 |
) -> Role:
|
| 1935 |
"""Update an environment role
|
| 1936 |
|
|
@@ -1954,7 +1950,7 @@ class Authorization:
|
|
| 1954 |
RateLimitExceededError: If rate limited (429).
|
| 1955 |
ServerError: If the server returns a 5xx error.
|
| 1956 |
"""
|
| 1957 |
-
body:
|
| 1958 |
k: v
|
| 1959 |
for k, v in {
|
| 1960 |
"name": name,
|
|
@@ -1976,7 +1972,7 @@ class Authorization:
|
|
| 1976 |
slug: str,
|
| 1977 |
*,
|
| 1978 |
body_slug: str,
|
| 1979 |
-
request_options:
|
| 1980 |
) -> Role:
|
| 1981 |
"""Add a permission to an environment role
|
| 1982 |
|
|
@@ -1999,7 +1995,7 @@ class Authorization:
|
|
| 1999 |
RateLimitExceededError: If rate limited (429).
|
| 2000 |
ServerError: If the server returns a 5xx error.
|
| 2001 |
"""
|
| 2002 |
-
body:
|
| 2003 |
"slug": body_slug,
|
| 2004 |
}
|
| 2005 |
return self._client.request(
|
|
@@ -2014,8 +2010,8 @@ class Authorization:
|
|
| 2014 |
self,
|
| 2015 |
slug: str,
|
| 2016 |
*,
|
| 2017 |
-
permissions:
|
| 2018 |
-
request_options:
|
| 2019 |
) -> Role:
|
| 2020 |
"""Set permissions for an environment role
|
| 2021 |
|
|
@@ -2038,7 +2034,7 @@ class Authorization:
|
|
| 2038 |
RateLimitExceededError: If rate limited (429).
|
| 2039 |
ServerError: If the server returns a 5xx error.
|
| 2040 |
"""
|
| 2041 |
-
body:
|
| 2042 |
"permissions": permissions,
|
| 2043 |
}
|
| 2044 |
return self._client.request(
|
|
@@ -2052,11 +2048,11 @@ class Authorization:
|
|
| 2052 |
def list_permissions(
|
| 2053 |
self,
|
| 2054 |
*,
|
| 2055 |
-
limit:
|
| 2056 |
-
before:
|
| 2057 |
-
after:
|
| 2058 |
-
order:
|
| 2059 |
-
request_options:
|
| 2060 |
) -> SyncPage[AuthorizationPermission]:
|
| 2061 |
"""List permissions
|
| 2062 |
|
|
@@ -2101,9 +2097,9 @@ class Authorization:
|
|
| 2101 |
*,
|
| 2102 |
slug: str,
|
| 2103 |
name: str,
|
| 2104 |
-
description:
|
| 2105 |
-
resource_type_slug:
|
| 2106 |
-
request_options:
|
| 2107 |
) -> Permission:
|
| 2108 |
"""Create a permission
|
| 2109 |
|
|
@@ -2128,7 +2124,7 @@ class Authorization:
|
|
| 2128 |
RateLimitExceededError: If rate limited (429).
|
| 2129 |
ServerError: If the server returns a 5xx error.
|
| 2130 |
"""
|
| 2131 |
-
body:
|
| 2132 |
k: v
|
| 2133 |
for k, v in {
|
| 2134 |
"slug": slug,
|
|
@@ -2151,7 +2147,7 @@ class Authorization:
|
|
| 2151 |
self,
|
| 2152 |
slug: str,
|
| 2153 |
*,
|
| 2154 |
-
request_options:
|
| 2155 |
) -> AuthorizationPermission:
|
| 2156 |
"""Get a permission
|
| 2157 |
|
|
@@ -2181,9 +2177,9 @@ class Authorization:
|
|
| 2181 |
self,
|
| 2182 |
slug: str,
|
| 2183 |
*,
|
| 2184 |
-
name:
|
| 2185 |
-
description:
|
| 2186 |
-
request_options:
|
| 2187 |
) -> AuthorizationPermission:
|
| 2188 |
"""Update a permission
|
| 2189 |
|
|
@@ -2206,7 +2202,7 @@ class Authorization:
|
|
| 2206 |
RateLimitExceededError: If rate limited (429).
|
| 2207 |
ServerError: If the server returns a 5xx error.
|
| 2208 |
"""
|
| 2209 |
-
body:
|
| 2210 |
k: v
|
| 2211 |
for k, v in {
|
| 2212 |
"name": name,
|
|
@@ -2227,7 +2223,7 @@ class Authorization:
|
|
| 2227 |
self,
|
| 2228 |
slug: str,
|
| 2229 |
*,
|
| 2230 |
-
request_options:
|
| 2231 |
) -> None:
|
| 2232 |
"""Delete a permission
|
| 2233 |
|
|
@@ -2254,18 +2250,18 @@ class Authorization:
|
|
| 2254 |
class AsyncAuthorization:
|
| 2255 |
"""Authorization API resources (async)."""
|
| 2256 |
|
| 2257 |
-
def __init__(self, client:
|
| 2258 |
self._client = client
|
| 2259 |
|
| 2260 |
async def list_group_role_assignments(
|
| 2261 |
self,
|
| 2262 |
group_id: str,
|
| 2263 |
*,
|
| 2264 |
-
limit:
|
| 2265 |
-
before:
|
| 2266 |
-
after:
|
| 2267 |
-
order:
|
| 2268 |
-
request_options:
|
| 2269 |
) -> AsyncPage[GroupRoleAssignment]:
|
| 2270 |
"""List role assignments for a group
|
| 2271 |
|
|
@@ -2312,10 +2308,10 @@ class AsyncAuthorization:
|
|
| 2312 |
group_id: str,
|
| 2313 |
*,
|
| 2314 |
role_slug: str,
|
| 2315 |
-
resource_id:
|
| 2316 |
-
resource_external_id:
|
| 2317 |
-
resource_type_slug:
|
| 2318 |
-
request_options:
|
| 2319 |
) -> GroupRoleAssignment:
|
| 2320 |
"""Assign a role to a group
|
| 2321 |
|
|
@@ -2341,7 +2337,7 @@ class AsyncAuthorization:
|
|
| 2341 |
RateLimitExceededError: If rate limited (429).
|
| 2342 |
ServerError: If the server returns a 5xx error.
|
| 2343 |
"""
|
| 2344 |
-
body:
|
| 2345 |
k: v
|
| 2346 |
for k, v in {
|
| 2347 |
"role_slug": role_slug,
|
|
@@ -2363,8 +2359,8 @@ class AsyncAuthorization:
|
|
| 2363 |
self,
|
| 2364 |
group_id: str,
|
| 2365 |
*,
|
| 2366 |
-
role_assignments:
|
| 2367 |
-
request_options:
|
| 2368 |
) -> GroupRoleAssignmentList:
|
| 2369 |
"""Replace all role assignments for a group
|
| 2370 |
|
|
@@ -2386,7 +2382,7 @@ class AsyncAuthorization:
|
|
| 2386 |
RateLimitExceededError: If rate limited (429).
|
| 2387 |
ServerError: If the server returns a 5xx error.
|
| 2388 |
"""
|
| 2389 |
-
body:
|
| 2390 |
"role_assignments": [item.to_dict() for item in role_assignments],
|
| 2391 |
}
|
| 2392 |
return await self._client.request(
|
|
@@ -2402,10 +2398,10 @@ class AsyncAuthorization:
|
|
| 2402 |
group_id: str,
|
| 2403 |
*,
|
| 2404 |
role_slug: str,
|
| 2405 |
-
resource_id:
|
| 2406 |
-
resource_external_id:
|
| 2407 |
-
resource_type_slug:
|
| 2408 |
-
request_options:
|
| 2409 |
) -> None:
|
| 2410 |
"""Remove group role assignments by criteria
|
| 2411 |
|
|
@@ -2427,7 +2423,7 @@ class AsyncAuthorization:
|
|
| 2427 |
RateLimitExceededError: If rate limited (429).
|
| 2428 |
ServerError: If the server returns a 5xx error.
|
| 2429 |
"""
|
| 2430 |
-
body:
|
| 2431 |
k: v
|
| 2432 |
for k, v in {
|
| 2433 |
"role_slug": role_slug,
|
|
@@ -2449,7 +2445,7 @@ class AsyncAuthorization:
|
|
| 2449 |
group_id: str,
|
| 2450 |
role_assignment_id: str,
|
| 2451 |
*,
|
| 2452 |
-
request_options:
|
| 2453 |
) -> GroupRoleAssignment:
|
| 2454 |
"""Get a group role assignment
|
| 2455 |
|
|
@@ -2488,7 +2484,7 @@ class AsyncAuthorization:
|
|
| 2488 |
group_id: str,
|
| 2489 |
role_assignment_id: str,
|
| 2490 |
*,
|
| 2491 |
-
request_options:
|
| 2492 |
) -> None:
|
| 2493 |
"""Remove a group role assignment
|
| 2494 |
|
|
@@ -2523,8 +2519,8 @@ class AsyncAuthorization:
|
|
| 2523 |
organization_membership_id: str,
|
| 2524 |
*,
|
| 2525 |
permission_slug: str,
|
| 2526 |
-
resource_target:
|
| 2527 |
-
request_options:
|
| 2528 |
) -> AuthorizationCheck:
|
| 2529 |
"""Check authorization
|
| 2530 |
|
|
@@ -2547,7 +2543,7 @@ class AsyncAuthorization:
|
|
| 2547 |
RateLimitExceededError: If rate limited (429).
|
| 2548 |
ServerError: If the server returns a 5xx error.
|
| 2549 |
"""
|
| 2550 |
-
body:
|
| 2551 |
"permission_slug": permission_slug,
|
| 2552 |
}
|
| 2553 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -2572,13 +2568,13 @@ class AsyncAuthorization:
|
|
| 2572 |
self,
|
| 2573 |
organization_membership_id: str,
|
| 2574 |
*,
|
| 2575 |
-
limit:
|
| 2576 |
-
before:
|
| 2577 |
-
after:
|
| 2578 |
-
order:
|
| 2579 |
permission_slug: str,
|
| 2580 |
-
parent_resource:
|
| 2581 |
-
request_options:
|
| 2582 |
) -> AsyncPage[AuthorizationResource]:
|
| 2583 |
"""List resources for organization membership
|
| 2584 |
|
|
@@ -2646,11 +2642,11 @@ class AsyncAuthorization:
|
|
| 2646 |
organization_membership_id: str,
|
| 2647 |
resource_id: str,
|
| 2648 |
*,
|
| 2649 |
-
limit:
|
| 2650 |
-
before:
|
| 2651 |
-
after:
|
| 2652 |
-
order:
|
| 2653 |
-
request_options:
|
| 2654 |
) -> AsyncPage[AuthorizationPermission]:
|
| 2655 |
"""List effective permissions for an organization membership on a resource
|
| 2656 |
|
|
@@ -2707,11 +2703,11 @@ class AsyncAuthorization:
|
|
| 2707 |
resource_type_slug: str,
|
| 2708 |
external_id: str,
|
| 2709 |
*,
|
| 2710 |
-
limit:
|
| 2711 |
-
before:
|
| 2712 |
-
after:
|
| 2713 |
-
order:
|
| 2714 |
-
request_options:
|
| 2715 |
) -> AsyncPage[AuthorizationPermission]:
|
| 2716 |
"""List effective permissions for an organization membership on a resource by external ID
|
| 2717 |
|
|
@@ -2768,14 +2764,14 @@ class AsyncAuthorization:
|
|
| 2768 |
self,
|
| 2769 |
organization_membership_id: str,
|
| 2770 |
*,
|
| 2771 |
-
limit:
|
| 2772 |
-
before:
|
| 2773 |
-
after:
|
| 2774 |
-
order:
|
| 2775 |
-
resource_id:
|
| 2776 |
-
resource_external_id:
|
| 2777 |
-
resource_type_slug:
|
| 2778 |
-
request_options:
|
| 2779 |
) -> AsyncPage[UserRoleAssignment]:
|
| 2780 |
"""List role assignments
|
| 2781 |
|
|
@@ -2833,8 +2829,8 @@ class AsyncAuthorization:
|
|
| 2833 |
organization_membership_id: str,
|
| 2834 |
*,
|
| 2835 |
role_slug: str,
|
| 2836 |
-
resource_target:
|
| 2837 |
-
request_options:
|
| 2838 |
) -> UserRoleAssignment:
|
| 2839 |
"""Assign a role
|
| 2840 |
|
|
@@ -2857,7 +2853,7 @@ class AsyncAuthorization:
|
|
| 2857 |
RateLimitExceededError: If rate limited (429).
|
| 2858 |
ServerError: If the server returns a 5xx error.
|
| 2859 |
"""
|
| 2860 |
-
body:
|
| 2861 |
"role_slug": role_slug,
|
| 2862 |
}
|
| 2863 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -2883,8 +2879,8 @@ class AsyncAuthorization:
|
|
| 2883 |
organization_membership_id: str,
|
| 2884 |
*,
|
| 2885 |
role_slug: str,
|
| 2886 |
-
resource_target:
|
| 2887 |
-
request_options:
|
| 2888 |
) -> None:
|
| 2889 |
"""Remove a role assignment
|
| 2890 |
|
|
@@ -2904,7 +2900,7 @@ class AsyncAuthorization:
|
|
| 2904 |
RateLimitExceededError: If rate limited (429).
|
| 2905 |
ServerError: If the server returns a 5xx error.
|
| 2906 |
"""
|
| 2907 |
-
body:
|
| 2908 |
"role_slug": role_slug,
|
| 2909 |
}
|
| 2910 |
if isinstance(resource_target, ResourceTargetById):
|
|
@@ -2929,7 +2925,7 @@ class AsyncAuthorization:
|
|
| 2929 |
organization_membership_id: str,
|
| 2930 |
role_assignment_id: str,
|
| 2931 |
*,
|
| 2932 |
-
request_options:
|
| 2933 |
) -> None:
|
| 2934 |
"""Remove a role assignment by ID
|
| 2935 |
|
|
@@ -2963,7 +2959,7 @@ class AsyncAuthorization:
|
|
| 2963 |
self,
|
| 2964 |
organization_id: str,
|
| 2965 |
*,
|
| 2966 |
-
request_options:
|
| 2967 |
) -> RoleList:
|
| 2968 |
"""List custom roles
|
| 2969 |
|
|
@@ -2995,10 +2991,10 @@ class AsyncAuthorization:
|
|
| 2995 |
organization_id: str,
|
| 2996 |
*,
|
| 2997 |
name: str,
|
| 2998 |
-
slug:
|
| 2999 |
-
description:
|
| 3000 |
-
resource_type_slug:
|
| 3001 |
-
request_options:
|
| 3002 |
) -> Role:
|
| 3003 |
"""Create a custom role
|
| 3004 |
|
|
@@ -3025,7 +3021,7 @@ class AsyncAuthorization:
|
|
| 3025 |
RateLimitExceededError: If rate limited (429).
|
| 3026 |
ServerError: If the server returns a 5xx error.
|
| 3027 |
"""
|
| 3028 |
-
body:
|
| 3029 |
k: v
|
| 3030 |
for k, v in {
|
| 3031 |
"slug": slug,
|
|
@@ -3049,7 +3045,7 @@ class AsyncAuthorization:
|
|
| 3049 |
organization_id: str,
|
| 3050 |
slug: str,
|
| 3051 |
*,
|
| 3052 |
-
request_options:
|
| 3053 |
) -> Role:
|
| 3054 |
"""Get a custom role
|
| 3055 |
|
|
@@ -3088,9 +3084,9 @@ class AsyncAuthorization:
|
|
| 3088 |
organization_id: str,
|
| 3089 |
slug: str,
|
| 3090 |
*,
|
| 3091 |
-
name:
|
| 3092 |
-
description:
|
| 3093 |
-
request_options:
|
| 3094 |
) -> Role:
|
| 3095 |
"""Update a custom role
|
| 3096 |
|
|
@@ -3115,7 +3111,7 @@ class AsyncAuthorization:
|
|
| 3115 |
RateLimitExceededError: If rate limited (429).
|
| 3116 |
ServerError: If the server returns a 5xx error.
|
| 3117 |
"""
|
| 3118 |
-
body:
|
| 3119 |
k: v
|
| 3120 |
for k, v in {
|
| 3121 |
"name": name,
|
|
@@ -3143,7 +3139,7 @@ class AsyncAuthorization:
|
|
| 3143 |
organization_id: str,
|
| 3144 |
slug: str,
|
| 3145 |
*,
|
| 3146 |
-
request_options:
|
| 3147 |
) -> None:
|
| 3148 |
"""Delete a custom role
|
| 3149 |
|
|
@@ -3181,7 +3177,7 @@ class AsyncAuthorization:
|
|
| 3181 |
slug: str,
|
| 3182 |
*,
|
| 3183 |
body_slug: str,
|
| 3184 |
-
request_options:
|
| 3185 |
) -> Role:
|
| 3186 |
"""Add a permission to a custom role
|
| 3187 |
|
|
@@ -3205,7 +3201,7 @@ class AsyncAuthorization:
|
|
| 3205 |
RateLimitExceededError: If rate limited (429).
|
| 3206 |
ServerError: If the server returns a 5xx error.
|
| 3207 |
"""
|
| 3208 |
-
body:
|
| 3209 |
"slug": body_slug,
|
| 3210 |
}
|
| 3211 |
return await self._client.request(
|
|
@@ -3228,8 +3224,8 @@ class AsyncAuthorization:
|
|
| 3228 |
organization_id: str,
|
| 3229 |
slug: str,
|
| 3230 |
*,
|
| 3231 |
-
permissions:
|
| 3232 |
-
request_options:
|
| 3233 |
) -> Role:
|
| 3234 |
"""Set permissions for a custom role
|
| 3235 |
|
|
@@ -3252,7 +3248,7 @@ class AsyncAuthorization:
|
|
| 3252 |
RateLimitExceededError: If rate limited (429).
|
| 3253 |
ServerError: If the server returns a 5xx error.
|
| 3254 |
"""
|
| 3255 |
-
body:
|
| 3256 |
"permissions": permissions,
|
| 3257 |
}
|
| 3258 |
return await self._client.request(
|
|
@@ -3276,7 +3272,7 @@ class AsyncAuthorization:
|
|
| 3276 |
slug: str,
|
| 3277 |
permission_slug: str,
|
| 3278 |
*,
|
| 3279 |
-
request_options:
|
| 3280 |
) -> None:
|
| 3281 |
"""Remove a permission from a custom role
|
| 3282 |
|
|
@@ -3315,7 +3311,7 @@ class AsyncAuthorization:
|
|
| 3315 |
resource_type_slug: str,
|
| 3316 |
external_id: str,
|
| 3317 |
*,
|
| 3318 |
-
request_options:
|
| 3319 |
) -> AuthorizationResource:
|
| 3320 |
"""Get a resource by external ID
|
| 3321 |
|
|
@@ -3357,12 +3353,10 @@ class AsyncAuthorization:
|
|
| 3357 |
resource_type_slug: str,
|
| 3358 |
external_id: str,
|
| 3359 |
*,
|
| 3360 |
-
name:
|
| 3361 |
-
description:
|
| 3362 |
-
parent_resource: Optional[
|
| 3363 |
-
|
| 3364 |
-
] = None,
|
| 3365 |
-
request_options:
|
| 3366 |
) -> AuthorizationResource:
|
| 3367 |
"""Update a resource by external ID
|
| 3368 |
|
|
@@ -3390,7 +3384,7 @@ class AsyncAuthorization:
|
|
| 3390 |
RateLimitExceededError: If rate limited (429).
|
| 3391 |
ServerError: If the server returns a 5xx error.
|
| 3392 |
"""
|
| 3393 |
-
body:
|
| 3394 |
k: v
|
| 3395 |
for k, v in {
|
| 3396 |
"name": name,
|
|
@@ -3430,8 +3424,8 @@ class AsyncAuthorization:
|
|
| 3430 |
resource_type_slug: str,
|
| 3431 |
external_id: str,
|
| 3432 |
*,
|
| 3433 |
-
cascade_delete:
|
| 3434 |
-
request_options:
|
| 3435 |
) -> None:
|
| 3436 |
"""Delete an authorization resource by external ID
|
| 3437 |
|
|
@@ -3453,7 +3447,7 @@ class AsyncAuthorization:
|
|
| 3453 |
RateLimitExceededError: If rate limited (429).
|
| 3454 |
ServerError: If the server returns a 5xx error.
|
| 3455 |
"""
|
| 3456 |
-
params:
|
| 3457 |
k: v
|
| 3458 |
for k, v in {
|
| 3459 |
"cascade_delete": cascade_delete,
|
|
@@ -3480,13 +3474,13 @@ class AsyncAuthorization:
|
|
| 3480 |
resource_type_slug: str,
|
| 3481 |
external_id: str,
|
| 3482 |
*,
|
| 3483 |
-
limit:
|
| 3484 |
-
before:
|
| 3485 |
-
after:
|
| 3486 |
-
order:
|
| 3487 |
permission_slug: str,
|
| 3488 |
-
assignment:
|
| 3489 |
-
request_options:
|
| 3490 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 3491 |
"""List memberships for a resource by external ID
|
| 3492 |
|
|
@@ -3552,12 +3546,12 @@ class AsyncAuthorization:
|
|
| 3552 |
resource_type_slug: str,
|
| 3553 |
external_id: str,
|
| 3554 |
*,
|
| 3555 |
-
limit:
|
| 3556 |
-
before:
|
| 3557 |
-
after:
|
| 3558 |
-
order:
|
| 3559 |
-
role_slug:
|
| 3560 |
-
request_options:
|
| 3561 |
) -> AsyncPage[UserRoleAssignment]:
|
| 3562 |
"""List role assignments for a resource by external ID
|
| 3563 |
|
|
@@ -3614,15 +3608,15 @@ class AsyncAuthorization:
|
|
| 3614 |
async def list_resources(
|
| 3615 |
self,
|
| 3616 |
*,
|
| 3617 |
-
limit:
|
| 3618 |
-
before:
|
| 3619 |
-
after:
|
| 3620 |
-
order:
|
| 3621 |
-
organization_id:
|
| 3622 |
-
resource_type_slug:
|
| 3623 |
-
resource_external_id:
|
| 3624 |
-
parent:
|
| 3625 |
-
request_options:
|
| 3626 |
) -> AsyncPage[AuthorizationResource]:
|
| 3627 |
"""List resources
|
| 3628 |
|
|
@@ -3684,11 +3678,9 @@ class AsyncAuthorization:
|
|
| 3684 |
name: str,
|
| 3685 |
resource_type_slug: str,
|
| 3686 |
organization_id: str,
|
| 3687 |
-
description:
|
| 3688 |
-
parent_resource: Optional[
|
| 3689 |
-
|
| 3690 |
-
] = None,
|
| 3691 |
-
request_options:
|
| 3692 |
) -> AuthorizationResource:
|
| 3693 |
"""Create an authorization resource
|
| 3694 |
|
|
@@ -3716,7 +3708,7 @@ class AsyncAuthorization:
|
|
| 3716 |
RateLimitExceededError: If rate limited (429).
|
| 3717 |
ServerError: If the server returns a 5xx error.
|
| 3718 |
"""
|
| 3719 |
-
body:
|
| 3720 |
"external_id": external_id,
|
| 3721 |
"name": name,
|
| 3722 |
"resource_type_slug": resource_type_slug,
|
|
@@ -3746,7 +3738,7 @@ class AsyncAuthorization:
|
|
| 3746 |
self,
|
| 3747 |
resource_id: str,
|
| 3748 |
*,
|
| 3749 |
-
request_options:
|
| 3750 |
) -> AuthorizationResource:
|
| 3751 |
"""Get a resource
|
| 3752 |
|
|
@@ -3778,12 +3770,10 @@ class AsyncAuthorization:
|
|
| 3778 |
self,
|
| 3779 |
resource_id: str,
|
| 3780 |
*,
|
| 3781 |
-
name:
|
| 3782 |
-
description:
|
| 3783 |
-
parent_resource: Optional[
|
| 3784 |
-
|
| 3785 |
-
] = None,
|
| 3786 |
-
request_options:
|
| 3787 |
) -> AuthorizationResource:
|
| 3788 |
"""Update a resource
|
| 3789 |
|
|
@@ -3809,7 +3799,7 @@ class AsyncAuthorization:
|
|
| 3809 |
RateLimitExceededError: If rate limited (429).
|
| 3810 |
ServerError: If the server returns a 5xx error.
|
| 3811 |
"""
|
| 3812 |
-
body:
|
| 3813 |
k: v
|
| 3814 |
for k, v in {
|
| 3815 |
"name": name,
|
|
@@ -3840,8 +3830,8 @@ class AsyncAuthorization:
|
|
| 3840 |
self,
|
| 3841 |
resource_id: str,
|
| 3842 |
*,
|
| 3843 |
-
cascade_delete:
|
| 3844 |
-
request_options:
|
| 3845 |
) -> None:
|
| 3846 |
"""Delete an authorization resource
|
| 3847 |
|
|
@@ -3861,7 +3851,7 @@ class AsyncAuthorization:
|
|
| 3861 |
RateLimitExceededError: If rate limited (429).
|
| 3862 |
ServerError: If the server returns a 5xx error.
|
| 3863 |
"""
|
| 3864 |
-
params:
|
| 3865 |
k: v
|
| 3866 |
for k, v in {
|
| 3867 |
"cascade_delete": cascade_delete,
|
|
@@ -3879,13 +3869,13 @@ class AsyncAuthorization:
|
|
| 3879 |
self,
|
| 3880 |
resource_id: str,
|
| 3881 |
*,
|
| 3882 |
-
limit:
|
| 3883 |
-
before:
|
| 3884 |
-
after:
|
| 3885 |
-
order:
|
| 3886 |
permission_slug: str,
|
| 3887 |
-
assignment:
|
| 3888 |
-
request_options:
|
| 3889 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 3890 |
"""List organization memberships for resource
|
| 3891 |
|
|
@@ -3944,12 +3934,12 @@ class AsyncAuthorization:
|
|
| 3944 |
self,
|
| 3945 |
resource_id: str,
|
| 3946 |
*,
|
| 3947 |
-
limit:
|
| 3948 |
-
before:
|
| 3949 |
-
after:
|
| 3950 |
-
order:
|
| 3951 |
-
role_slug:
|
| 3952 |
-
request_options:
|
| 3953 |
) -> AsyncPage[UserRoleAssignment]:
|
| 3954 |
"""List role assignments for a resource
|
| 3955 |
|
|
@@ -3996,7 +3986,7 @@ class AsyncAuthorization:
|
|
| 3996 |
async def list_environment_roles(
|
| 3997 |
self,
|
| 3998 |
*,
|
| 3999 |
-
request_options:
|
| 4000 |
) -> RoleList:
|
| 4001 |
"""List environment roles
|
| 4002 |
|
|
@@ -4023,9 +4013,9 @@ class AsyncAuthorization:
|
|
| 4023 |
*,
|
| 4024 |
slug: str,
|
| 4025 |
name: str,
|
| 4026 |
-
description:
|
| 4027 |
-
resource_type_slug:
|
| 4028 |
-
request_options:
|
| 4029 |
) -> Role:
|
| 4030 |
"""Create an environment role
|
| 4031 |
|
|
@@ -4051,7 +4041,7 @@ class AsyncAuthorization:
|
|
| 4051 |
RateLimitExceededError: If rate limited (429).
|
| 4052 |
ServerError: If the server returns a 5xx error.
|
| 4053 |
"""
|
| 4054 |
-
body:
|
| 4055 |
k: v
|
| 4056 |
for k, v in {
|
| 4057 |
"slug": slug,
|
|
@@ -4074,7 +4064,7 @@ class AsyncAuthorization:
|
|
| 4074 |
self,
|
| 4075 |
slug: str,
|
| 4076 |
*,
|
| 4077 |
-
request_options:
|
| 4078 |
) -> Role:
|
| 4079 |
"""Get an environment role
|
| 4080 |
|
|
@@ -4105,9 +4095,9 @@ class AsyncAuthorization:
|
|
| 4105 |
self,
|
| 4106 |
slug: str,
|
| 4107 |
*,
|
| 4108 |
-
name:
|
| 4109 |
-
description:
|
| 4110 |
-
request_options:
|
| 4111 |
) -> Role:
|
| 4112 |
"""Update an environment role
|
| 4113 |
|
|
@@ -4131,7 +4121,7 @@ class AsyncAuthorization:
|
|
| 4131 |
RateLimitExceededError: If rate limited (429).
|
| 4132 |
ServerError: If the server returns a 5xx error.
|
| 4133 |
"""
|
| 4134 |
-
body:
|
| 4135 |
k: v
|
| 4136 |
for k, v in {
|
| 4137 |
"name": name,
|
|
@@ -4153,7 +4143,7 @@ class AsyncAuthorization:
|
|
| 4153 |
slug: str,
|
| 4154 |
*,
|
| 4155 |
body_slug: str,
|
| 4156 |
-
request_options:
|
| 4157 |
) -> Role:
|
| 4158 |
"""Add a permission to an environment role
|
| 4159 |
|
|
@@ -4176,7 +4166,7 @@ class AsyncAuthorization:
|
|
| 4176 |
RateLimitExceededError: If rate limited (429).
|
| 4177 |
ServerError: If the server returns a 5xx error.
|
| 4178 |
"""
|
| 4179 |
-
body:
|
| 4180 |
"slug": body_slug,
|
| 4181 |
}
|
| 4182 |
return await self._client.request(
|
|
@@ -4191,8 +4181,8 @@ class AsyncAuthorization:
|
|
| 4191 |
self,
|
| 4192 |
slug: str,
|
| 4193 |
*,
|
| 4194 |
-
permissions:
|
| 4195 |
-
request_options:
|
| 4196 |
) -> Role:
|
| 4197 |
"""Set permissions for an environment role
|
| 4198 |
|
|
@@ -4215,7 +4205,7 @@ class AsyncAuthorization:
|
|
| 4215 |
RateLimitExceededError: If rate limited (429).
|
| 4216 |
ServerError: If the server returns a 5xx error.
|
| 4217 |
"""
|
| 4218 |
-
body:
|
| 4219 |
"permissions": permissions,
|
| 4220 |
}
|
| 4221 |
return await self._client.request(
|
|
@@ -4229,11 +4219,11 @@ class AsyncAuthorization:
|
|
| 4229 |
async def list_permissions(
|
| 4230 |
self,
|
| 4231 |
*,
|
| 4232 |
-
limit:
|
| 4233 |
-
before:
|
| 4234 |
-
after:
|
| 4235 |
-
order:
|
| 4236 |
-
request_options:
|
| 4237 |
) -> AsyncPage[AuthorizationPermission]:
|
| 4238 |
"""List permissions
|
| 4239 |
|
|
@@ -4278,9 +4268,9 @@ class AsyncAuthorization:
|
|
| 4278 |
*,
|
| 4279 |
slug: str,
|
| 4280 |
name: str,
|
| 4281 |
-
description:
|
| 4282 |
-
resource_type_slug:
|
| 4283 |
-
request_options:
|
| 4284 |
) -> Permission:
|
| 4285 |
"""Create a permission
|
| 4286 |
|
|
@@ -4305,7 +4295,7 @@ class AsyncAuthorization:
|
|
| 4305 |
RateLimitExceededError: If rate limited (429).
|
| 4306 |
ServerError: If the server returns a 5xx error.
|
| 4307 |
"""
|
| 4308 |
-
body:
|
| 4309 |
k: v
|
| 4310 |
for k, v in {
|
| 4311 |
"slug": slug,
|
|
@@ -4328,7 +4318,7 @@ class AsyncAuthorization:
|
|
| 4328 |
self,
|
| 4329 |
slug: str,
|
| 4330 |
*,
|
| 4331 |
-
request_options:
|
| 4332 |
) -> AuthorizationPermission:
|
| 4333 |
"""Get a permission
|
| 4334 |
|
|
@@ -4358,9 +4348,9 @@ class AsyncAuthorization:
|
|
| 4358 |
self,
|
| 4359 |
slug: str,
|
| 4360 |
*,
|
| 4361 |
-
name:
|
| 4362 |
-
description:
|
| 4363 |
-
request_options:
|
| 4364 |
) -> AuthorizationPermission:
|
| 4365 |
"""Update a permission
|
| 4366 |
|
|
@@ -4383,7 +4373,7 @@ class AsyncAuthorization:
|
|
| 4383 |
RateLimitExceededError: If rate limited (429).
|
| 4384 |
ServerError: If the server returns a 5xx error.
|
| 4385 |
"""
|
| 4386 |
-
body:
|
| 4387 |
k: v
|
| 4388 |
for k, v in {
|
| 4389 |
"name": name,
|
|
@@ -4404,7 +4394,7 @@ class AsyncAuthorization:
|
|
| 4404 |
self,
|
| 4405 |
slug: str,
|
| 4406 |
*,
|
| 4407 |
-
request_options:
|
| 4408 |
) -> None:
|
| 4409 |
"""Delete a permission
|
| 4410 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from dataclasses import dataclass
|
| 11 |
+
|
| 12 |
+
from workos.common.models.authorization_permission import AuthorizationPermission
|
| 13 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 14 |
+
from workos.common.models.user_organization_membership_base_list_data import (
|
| 15 |
+
UserOrganizationMembershipBaseListData,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
from .._pagination import AsyncPage, SyncPage
|
| 19 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 20 |
from .models import (
|
| 21 |
+
AuthorizationAssignment,
|
| 22 |
AuthorizationCheck,
|
| 23 |
AuthorizationResource,
|
| 24 |
GroupRoleAssignment,
|
|
|
|
| 29 |
RoleList,
|
| 30 |
UserRoleAssignment,
|
| 31 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
@dataclass
|
|
|
|
| 79 |
class Authorization:
|
| 80 |
"""Authorization API resources."""
|
| 81 |
|
| 82 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 83 |
self._client = client
|
| 84 |
|
| 85 |
def list_group_role_assignments(
|
| 86 |
self,
|
| 87 |
group_id: str,
|
| 88 |
*,
|
| 89 |
+
limit: int | None = None,
|
| 90 |
+
before: str | None = None,
|
| 91 |
+
after: str | None = None,
|
| 92 |
+
order: PaginationOrder | str | None = "desc",
|
| 93 |
+
request_options: RequestOptions | None = None,
|
| 94 |
) -> SyncPage[GroupRoleAssignment]:
|
| 95 |
"""List role assignments for a group
|
| 96 |
|
|
|
|
| 137 |
group_id: str,
|
| 138 |
*,
|
| 139 |
role_slug: str,
|
| 140 |
+
resource_id: str | None = None,
|
| 141 |
+
resource_external_id: str | None = None,
|
| 142 |
+
resource_type_slug: str | None = None,
|
| 143 |
+
request_options: RequestOptions | None = None,
|
| 144 |
) -> GroupRoleAssignment:
|
| 145 |
"""Assign a role to a group
|
| 146 |
|
|
|
|
| 166 |
RateLimitExceededError: If rate limited (429).
|
| 167 |
ServerError: If the server returns a 5xx error.
|
| 168 |
"""
|
| 169 |
+
body: dict[str, Any] = {
|
| 170 |
k: v
|
| 171 |
for k, v in {
|
| 172 |
"role_slug": role_slug,
|
|
|
|
| 188 |
self,
|
| 189 |
group_id: str,
|
| 190 |
*,
|
| 191 |
+
role_assignments: list[ReplaceGroupRoleAssignmentEntry],
|
| 192 |
+
request_options: RequestOptions | None = None,
|
| 193 |
) -> GroupRoleAssignmentList:
|
| 194 |
"""Replace all role assignments for a group
|
| 195 |
|
|
|
|
| 211 |
RateLimitExceededError: If rate limited (429).
|
| 212 |
ServerError: If the server returns a 5xx error.
|
| 213 |
"""
|
| 214 |
+
body: dict[str, Any] = {
|
| 215 |
"role_assignments": [item.to_dict() for item in role_assignments],
|
| 216 |
}
|
| 217 |
return self._client.request(
|
|
|
|
| 227 |
group_id: str,
|
| 228 |
*,
|
| 229 |
role_slug: str,
|
| 230 |
+
resource_id: str | None = None,
|
| 231 |
+
resource_external_id: str | None = None,
|
| 232 |
+
resource_type_slug: str | None = None,
|
| 233 |
+
request_options: RequestOptions | None = None,
|
| 234 |
) -> None:
|
| 235 |
"""Remove group role assignments by criteria
|
| 236 |
|
|
|
|
| 252 |
RateLimitExceededError: If rate limited (429).
|
| 253 |
ServerError: If the server returns a 5xx error.
|
| 254 |
"""
|
| 255 |
+
body: dict[str, Any] = {
|
| 256 |
k: v
|
| 257 |
for k, v in {
|
| 258 |
"role_slug": role_slug,
|
|
|
|
| 274 |
group_id: str,
|
| 275 |
role_assignment_id: str,
|
| 276 |
*,
|
| 277 |
+
request_options: RequestOptions | None = None,
|
| 278 |
) -> GroupRoleAssignment:
|
| 279 |
"""Get a group role assignment
|
| 280 |
|
|
|
|
| 313 |
group_id: str,
|
| 314 |
role_assignment_id: str,
|
| 315 |
*,
|
| 316 |
+
request_options: RequestOptions | None = None,
|
| 317 |
) -> None:
|
| 318 |
"""Remove a group role assignment
|
| 319 |
|
|
|
|
| 348 |
organization_membership_id: str,
|
| 349 |
*,
|
| 350 |
permission_slug: str,
|
| 351 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 352 |
+
request_options: RequestOptions | None = None,
|
| 353 |
) -> AuthorizationCheck:
|
| 354 |
"""Check authorization
|
| 355 |
|
|
|
|
| 372 |
RateLimitExceededError: If rate limited (429).
|
| 373 |
ServerError: If the server returns a 5xx error.
|
| 374 |
"""
|
| 375 |
+
body: dict[str, Any] = {
|
| 376 |
"permission_slug": permission_slug,
|
| 377 |
}
|
| 378 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 397 |
self,
|
| 398 |
organization_membership_id: str,
|
| 399 |
*,
|
| 400 |
+
limit: int | None = None,
|
| 401 |
+
before: str | None = None,
|
| 402 |
+
after: str | None = None,
|
| 403 |
+
order: PaginationOrder | str | None = "desc",
|
| 404 |
permission_slug: str,
|
| 405 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId,
|
| 406 |
+
request_options: RequestOptions | None = None,
|
| 407 |
) -> SyncPage[AuthorizationResource]:
|
| 408 |
"""List resources for organization membership
|
| 409 |
|
|
|
|
| 471 |
organization_membership_id: str,
|
| 472 |
resource_id: str,
|
| 473 |
*,
|
| 474 |
+
limit: int | None = None,
|
| 475 |
+
before: str | None = None,
|
| 476 |
+
after: str | None = None,
|
| 477 |
+
order: PaginationOrder | str | None = "desc",
|
| 478 |
+
request_options: RequestOptions | None = None,
|
| 479 |
) -> SyncPage[AuthorizationPermission]:
|
| 480 |
"""List effective permissions for an organization membership on a resource
|
| 481 |
|
|
|
|
| 532 |
resource_type_slug: str,
|
| 533 |
external_id: str,
|
| 534 |
*,
|
| 535 |
+
limit: int | None = None,
|
| 536 |
+
before: str | None = None,
|
| 537 |
+
after: str | None = None,
|
| 538 |
+
order: PaginationOrder | str | None = "desc",
|
| 539 |
+
request_options: RequestOptions | None = None,
|
| 540 |
) -> SyncPage[AuthorizationPermission]:
|
| 541 |
"""List effective permissions for an organization membership on a resource by external ID
|
| 542 |
|
|
|
|
| 593 |
self,
|
| 594 |
organization_membership_id: str,
|
| 595 |
*,
|
| 596 |
+
limit: int | None = None,
|
| 597 |
+
before: str | None = None,
|
| 598 |
+
after: str | None = None,
|
| 599 |
+
order: PaginationOrder | str | None = "desc",
|
| 600 |
+
resource_id: str | None = None,
|
| 601 |
+
resource_external_id: str | None = None,
|
| 602 |
+
resource_type_slug: str | None = None,
|
| 603 |
+
request_options: RequestOptions | None = None,
|
| 604 |
) -> SyncPage[UserRoleAssignment]:
|
| 605 |
"""List role assignments
|
| 606 |
|
|
|
|
| 658 |
organization_membership_id: str,
|
| 659 |
*,
|
| 660 |
role_slug: str,
|
| 661 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 662 |
+
request_options: RequestOptions | None = None,
|
| 663 |
) -> UserRoleAssignment:
|
| 664 |
"""Assign a role
|
| 665 |
|
|
|
|
| 682 |
RateLimitExceededError: If rate limited (429).
|
| 683 |
ServerError: If the server returns a 5xx error.
|
| 684 |
"""
|
| 685 |
+
body: dict[str, Any] = {
|
| 686 |
"role_slug": role_slug,
|
| 687 |
}
|
| 688 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 708 |
organization_membership_id: str,
|
| 709 |
*,
|
| 710 |
role_slug: str,
|
| 711 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 712 |
+
request_options: RequestOptions | None = None,
|
| 713 |
) -> None:
|
| 714 |
"""Remove a role assignment
|
| 715 |
|
|
|
|
| 729 |
RateLimitExceededError: If rate limited (429).
|
| 730 |
ServerError: If the server returns a 5xx error.
|
| 731 |
"""
|
| 732 |
+
body: dict[str, Any] = {
|
| 733 |
"role_slug": role_slug,
|
| 734 |
}
|
| 735 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 754 |
organization_membership_id: str,
|
| 755 |
role_assignment_id: str,
|
| 756 |
*,
|
| 757 |
+
request_options: RequestOptions | None = None,
|
| 758 |
) -> None:
|
| 759 |
"""Remove a role assignment by ID
|
| 760 |
|
|
|
|
| 788 |
self,
|
| 789 |
organization_id: str,
|
| 790 |
*,
|
| 791 |
+
request_options: RequestOptions | None = None,
|
| 792 |
) -> RoleList:
|
| 793 |
"""List custom roles
|
| 794 |
|
|
|
|
| 820 |
organization_id: str,
|
| 821 |
*,
|
| 822 |
name: str,
|
| 823 |
+
slug: str | None = None,
|
| 824 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 825 |
+
resource_type_slug: str | None = None,
|
| 826 |
+
request_options: RequestOptions | None = None,
|
| 827 |
) -> Role:
|
| 828 |
"""Create a custom role
|
| 829 |
|
|
|
|
| 850 |
RateLimitExceededError: If rate limited (429).
|
| 851 |
ServerError: If the server returns a 5xx error.
|
| 852 |
"""
|
| 853 |
+
body: dict[str, Any] = {
|
| 854 |
k: v
|
| 855 |
for k, v in {
|
| 856 |
"slug": slug,
|
|
|
|
| 874 |
organization_id: str,
|
| 875 |
slug: str,
|
| 876 |
*,
|
| 877 |
+
request_options: RequestOptions | None = None,
|
| 878 |
) -> Role:
|
| 879 |
"""Get a custom role
|
| 880 |
|
|
|
|
| 913 |
organization_id: str,
|
| 914 |
slug: str,
|
| 915 |
*,
|
| 916 |
+
name: str | None = None,
|
| 917 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 918 |
+
request_options: RequestOptions | None = None,
|
| 919 |
) -> Role:
|
| 920 |
"""Update a custom role
|
| 921 |
|
|
|
|
| 940 |
RateLimitExceededError: If rate limited (429).
|
| 941 |
ServerError: If the server returns a 5xx error.
|
| 942 |
"""
|
| 943 |
+
body: dict[str, Any] = {
|
| 944 |
k: v
|
| 945 |
for k, v in {
|
| 946 |
"name": name,
|
|
|
|
| 968 |
organization_id: str,
|
| 969 |
slug: str,
|
| 970 |
*,
|
| 971 |
+
request_options: RequestOptions | None = None,
|
| 972 |
) -> None:
|
| 973 |
"""Delete a custom role
|
| 974 |
|
|
|
|
| 1006 |
slug: str,
|
| 1007 |
*,
|
| 1008 |
body_slug: str,
|
| 1009 |
+
request_options: RequestOptions | None = None,
|
| 1010 |
) -> Role:
|
| 1011 |
"""Add a permission to a custom role
|
| 1012 |
|
|
|
|
| 1030 |
RateLimitExceededError: If rate limited (429).
|
| 1031 |
ServerError: If the server returns a 5xx error.
|
| 1032 |
"""
|
| 1033 |
+
body: dict[str, Any] = {
|
| 1034 |
"slug": body_slug,
|
| 1035 |
}
|
| 1036 |
return self._client.request(
|
|
|
|
| 1053 |
organization_id: str,
|
| 1054 |
slug: str,
|
| 1055 |
*,
|
| 1056 |
+
permissions: list[str],
|
| 1057 |
+
request_options: RequestOptions | None = None,
|
| 1058 |
) -> Role:
|
| 1059 |
"""Set permissions for a custom role
|
| 1060 |
|
|
|
|
| 1077 |
RateLimitExceededError: If rate limited (429).
|
| 1078 |
ServerError: If the server returns a 5xx error.
|
| 1079 |
"""
|
| 1080 |
+
body: dict[str, Any] = {
|
| 1081 |
"permissions": permissions,
|
| 1082 |
}
|
| 1083 |
return self._client.request(
|
|
|
|
| 1101 |
slug: str,
|
| 1102 |
permission_slug: str,
|
| 1103 |
*,
|
| 1104 |
+
request_options: RequestOptions | None = None,
|
| 1105 |
) -> None:
|
| 1106 |
"""Remove a permission from a custom role
|
| 1107 |
|
|
|
|
| 1140 |
resource_type_slug: str,
|
| 1141 |
external_id: str,
|
| 1142 |
*,
|
| 1143 |
+
request_options: RequestOptions | None = None,
|
| 1144 |
) -> AuthorizationResource:
|
| 1145 |
"""Get a resource by external ID
|
| 1146 |
|
|
|
|
| 1182 |
resource_type_slug: str,
|
| 1183 |
external_id: str,
|
| 1184 |
*,
|
| 1185 |
+
name: str | None = None,
|
| 1186 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 1187 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 1188 |
+
request_options: RequestOptions | None = None,
|
| 1189 |
) -> AuthorizationResource:
|
| 1190 |
"""Update a resource by external ID
|
| 1191 |
|
|
|
|
| 1213 |
RateLimitExceededError: If rate limited (429).
|
| 1214 |
ServerError: If the server returns a 5xx error.
|
| 1215 |
"""
|
| 1216 |
+
body: dict[str, Any] = {
|
| 1217 |
k: v
|
| 1218 |
for k, v in {
|
| 1219 |
"name": name,
|
|
|
|
| 1253 |
resource_type_slug: str,
|
| 1254 |
external_id: str,
|
| 1255 |
*,
|
| 1256 |
+
cascade_delete: bool | None = None,
|
| 1257 |
+
request_options: RequestOptions | None = None,
|
| 1258 |
) -> None:
|
| 1259 |
"""Delete an authorization resource by external ID
|
| 1260 |
|
|
|
|
| 1276 |
RateLimitExceededError: If rate limited (429).
|
| 1277 |
ServerError: If the server returns a 5xx error.
|
| 1278 |
"""
|
| 1279 |
+
params: dict[str, Any] = {
|
| 1280 |
k: v
|
| 1281 |
for k, v in {
|
| 1282 |
"cascade_delete": cascade_delete,
|
|
|
|
| 1303 |
resource_type_slug: str,
|
| 1304 |
external_id: str,
|
| 1305 |
*,
|
| 1306 |
+
limit: int | None = None,
|
| 1307 |
+
before: str | None = None,
|
| 1308 |
+
after: str | None = None,
|
| 1309 |
+
order: PaginationOrder | str | None = "desc",
|
| 1310 |
permission_slug: str,
|
| 1311 |
+
assignment: AuthorizationAssignment | str | None = None,
|
| 1312 |
+
request_options: RequestOptions | None = None,
|
| 1313 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 1314 |
"""List memberships for a resource by external ID
|
| 1315 |
|
|
|
|
| 1375 |
resource_type_slug: str,
|
| 1376 |
external_id: str,
|
| 1377 |
*,
|
| 1378 |
+
limit: int | None = None,
|
| 1379 |
+
before: str | None = None,
|
| 1380 |
+
after: str | None = None,
|
| 1381 |
+
order: PaginationOrder | str | None = "desc",
|
| 1382 |
+
role_slug: str | None = None,
|
| 1383 |
+
request_options: RequestOptions | None = None,
|
| 1384 |
) -> SyncPage[UserRoleAssignment]:
|
| 1385 |
"""List role assignments for a resource by external ID
|
| 1386 |
|
|
|
|
| 1437 |
def list_resources(
|
| 1438 |
self,
|
| 1439 |
*,
|
| 1440 |
+
limit: int | None = None,
|
| 1441 |
+
before: str | None = None,
|
| 1442 |
+
after: str | None = None,
|
| 1443 |
+
order: PaginationOrder | str | None = "desc",
|
| 1444 |
+
organization_id: str | None = None,
|
| 1445 |
+
resource_type_slug: str | None = None,
|
| 1446 |
+
resource_external_id: str | None = None,
|
| 1447 |
+
parent: ParentById | ParentByExternalId | None = None,
|
| 1448 |
+
request_options: RequestOptions | None = None,
|
| 1449 |
) -> SyncPage[AuthorizationResource]:
|
| 1450 |
"""List resources
|
| 1451 |
|
|
|
|
| 1507 |
name: str,
|
| 1508 |
resource_type_slug: str,
|
| 1509 |
organization_id: str,
|
| 1510 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 1511 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 1512 |
+
request_options: RequestOptions | None = None,
|
| 1513 |
) -> AuthorizationResource:
|
| 1514 |
"""Create an authorization resource
|
| 1515 |
|
|
|
|
| 1537 |
RateLimitExceededError: If rate limited (429).
|
| 1538 |
ServerError: If the server returns a 5xx error.
|
| 1539 |
"""
|
| 1540 |
+
body: dict[str, Any] = {
|
| 1541 |
"external_id": external_id,
|
| 1542 |
"name": name,
|
| 1543 |
"resource_type_slug": resource_type_slug,
|
|
|
|
| 1567 |
self,
|
| 1568 |
resource_id: str,
|
| 1569 |
*,
|
| 1570 |
+
request_options: RequestOptions | None = None,
|
| 1571 |
) -> AuthorizationResource:
|
| 1572 |
"""Get a resource
|
| 1573 |
|
|
|
|
| 1599 |
self,
|
| 1600 |
resource_id: str,
|
| 1601 |
*,
|
| 1602 |
+
name: str | None = None,
|
| 1603 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 1604 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 1605 |
+
request_options: RequestOptions | None = None,
|
| 1606 |
) -> AuthorizationResource:
|
| 1607 |
"""Update a resource
|
| 1608 |
|
|
|
|
| 1628 |
RateLimitExceededError: If rate limited (429).
|
| 1629 |
ServerError: If the server returns a 5xx error.
|
| 1630 |
"""
|
| 1631 |
+
body: dict[str, Any] = {
|
| 1632 |
k: v
|
| 1633 |
for k, v in {
|
| 1634 |
"name": name,
|
|
|
|
| 1659 |
self,
|
| 1660 |
resource_id: str,
|
| 1661 |
*,
|
| 1662 |
+
cascade_delete: bool | None = None,
|
| 1663 |
+
request_options: RequestOptions | None = None,
|
| 1664 |
) -> None:
|
| 1665 |
"""Delete an authorization resource
|
| 1666 |
|
|
|
|
| 1680 |
RateLimitExceededError: If rate limited (429).
|
| 1681 |
ServerError: If the server returns a 5xx error.
|
| 1682 |
"""
|
| 1683 |
+
params: dict[str, Any] = {
|
| 1684 |
k: v
|
| 1685 |
for k, v in {
|
| 1686 |
"cascade_delete": cascade_delete,
|
|
|
|
| 1698 |
self,
|
| 1699 |
resource_id: str,
|
| 1700 |
*,
|
| 1701 |
+
limit: int | None = None,
|
| 1702 |
+
before: str | None = None,
|
| 1703 |
+
after: str | None = None,
|
| 1704 |
+
order: PaginationOrder | str | None = "desc",
|
| 1705 |
permission_slug: str,
|
| 1706 |
+
assignment: AuthorizationAssignment | str | None = None,
|
| 1707 |
+
request_options: RequestOptions | None = None,
|
| 1708 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 1709 |
"""List organization memberships for resource
|
| 1710 |
|
|
|
|
| 1763 |
self,
|
| 1764 |
resource_id: str,
|
| 1765 |
*,
|
| 1766 |
+
limit: int | None = None,
|
| 1767 |
+
before: str | None = None,
|
| 1768 |
+
after: str | None = None,
|
| 1769 |
+
order: PaginationOrder | str | None = "desc",
|
| 1770 |
+
role_slug: str | None = None,
|
| 1771 |
+
request_options: RequestOptions | None = None,
|
| 1772 |
) -> SyncPage[UserRoleAssignment]:
|
| 1773 |
"""List role assignments for a resource
|
| 1774 |
|
|
|
|
| 1815 |
def list_environment_roles(
|
| 1816 |
self,
|
| 1817 |
*,
|
| 1818 |
+
request_options: RequestOptions | None = None,
|
| 1819 |
) -> RoleList:
|
| 1820 |
"""List environment roles
|
| 1821 |
|
|
|
|
| 1842 |
*,
|
| 1843 |
slug: str,
|
| 1844 |
name: str,
|
| 1845 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 1846 |
+
resource_type_slug: str | None = None,
|
| 1847 |
+
request_options: RequestOptions | None = None,
|
| 1848 |
) -> Role:
|
| 1849 |
"""Create an environment role
|
| 1850 |
|
|
|
|
| 1870 |
RateLimitExceededError: If rate limited (429).
|
| 1871 |
ServerError: If the server returns a 5xx error.
|
| 1872 |
"""
|
| 1873 |
+
body: dict[str, Any] = {
|
| 1874 |
k: v
|
| 1875 |
for k, v in {
|
| 1876 |
"slug": slug,
|
|
|
|
| 1893 |
self,
|
| 1894 |
slug: str,
|
| 1895 |
*,
|
| 1896 |
+
request_options: RequestOptions | None = None,
|
| 1897 |
) -> Role:
|
| 1898 |
"""Get an environment role
|
| 1899 |
|
|
|
|
| 1924 |
self,
|
| 1925 |
slug: str,
|
| 1926 |
*,
|
| 1927 |
+
name: str | None = None,
|
| 1928 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 1929 |
+
request_options: RequestOptions | None = None,
|
| 1930 |
) -> Role:
|
| 1931 |
"""Update an environment role
|
| 1932 |
|
|
|
|
| 1950 |
RateLimitExceededError: If rate limited (429).
|
| 1951 |
ServerError: If the server returns a 5xx error.
|
| 1952 |
"""
|
| 1953 |
+
body: dict[str, Any] = {
|
| 1954 |
k: v
|
| 1955 |
for k, v in {
|
| 1956 |
"name": name,
|
|
|
|
| 1972 |
slug: str,
|
| 1973 |
*,
|
| 1974 |
body_slug: str,
|
| 1975 |
+
request_options: RequestOptions | None = None,
|
| 1976 |
) -> Role:
|
| 1977 |
"""Add a permission to an environment role
|
| 1978 |
|
|
|
|
| 1995 |
RateLimitExceededError: If rate limited (429).
|
| 1996 |
ServerError: If the server returns a 5xx error.
|
| 1997 |
"""
|
| 1998 |
+
body: dict[str, Any] = {
|
| 1999 |
"slug": body_slug,
|
| 2000 |
}
|
| 2001 |
return self._client.request(
|
|
|
|
| 2010 |
self,
|
| 2011 |
slug: str,
|
| 2012 |
*,
|
| 2013 |
+
permissions: list[str],
|
| 2014 |
+
request_options: RequestOptions | None = None,
|
| 2015 |
) -> Role:
|
| 2016 |
"""Set permissions for an environment role
|
| 2017 |
|
|
|
|
| 2034 |
RateLimitExceededError: If rate limited (429).
|
| 2035 |
ServerError: If the server returns a 5xx error.
|
| 2036 |
"""
|
| 2037 |
+
body: dict[str, Any] = {
|
| 2038 |
"permissions": permissions,
|
| 2039 |
}
|
| 2040 |
return self._client.request(
|
|
|
|
| 2048 |
def list_permissions(
|
| 2049 |
self,
|
| 2050 |
*,
|
| 2051 |
+
limit: int | None = None,
|
| 2052 |
+
before: str | None = None,
|
| 2053 |
+
after: str | None = None,
|
| 2054 |
+
order: PaginationOrder | str | None = "desc",
|
| 2055 |
+
request_options: RequestOptions | None = None,
|
| 2056 |
) -> SyncPage[AuthorizationPermission]:
|
| 2057 |
"""List permissions
|
| 2058 |
|
|
|
|
| 2097 |
*,
|
| 2098 |
slug: str,
|
| 2099 |
name: str,
|
| 2100 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 2101 |
+
resource_type_slug: str | None = None,
|
| 2102 |
+
request_options: RequestOptions | None = None,
|
| 2103 |
) -> Permission:
|
| 2104 |
"""Create a permission
|
| 2105 |
|
|
|
|
| 2124 |
RateLimitExceededError: If rate limited (429).
|
| 2125 |
ServerError: If the server returns a 5xx error.
|
| 2126 |
"""
|
| 2127 |
+
body: dict[str, Any] = {
|
| 2128 |
k: v
|
| 2129 |
for k, v in {
|
| 2130 |
"slug": slug,
|
|
|
|
| 2147 |
self,
|
| 2148 |
slug: str,
|
| 2149 |
*,
|
| 2150 |
+
request_options: RequestOptions | None = None,
|
| 2151 |
) -> AuthorizationPermission:
|
| 2152 |
"""Get a permission
|
| 2153 |
|
|
|
|
| 2177 |
self,
|
| 2178 |
slug: str,
|
| 2179 |
*,
|
| 2180 |
+
name: str | None = None,
|
| 2181 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 2182 |
+
request_options: RequestOptions | None = None,
|
| 2183 |
) -> AuthorizationPermission:
|
| 2184 |
"""Update a permission
|
| 2185 |
|
|
|
|
| 2202 |
RateLimitExceededError: If rate limited (429).
|
| 2203 |
ServerError: If the server returns a 5xx error.
|
| 2204 |
"""
|
| 2205 |
+
body: dict[str, Any] = {
|
| 2206 |
k: v
|
| 2207 |
for k, v in {
|
| 2208 |
"name": name,
|
|
|
|
| 2223 |
self,
|
| 2224 |
slug: str,
|
| 2225 |
*,
|
| 2226 |
+
request_options: RequestOptions | None = None,
|
| 2227 |
) -> None:
|
| 2228 |
"""Delete a permission
|
| 2229 |
|
|
|
|
| 2250 |
class AsyncAuthorization:
|
| 2251 |
"""Authorization API resources (async)."""
|
| 2252 |
|
| 2253 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 2254 |
self._client = client
|
| 2255 |
|
| 2256 |
async def list_group_role_assignments(
|
| 2257 |
self,
|
| 2258 |
group_id: str,
|
| 2259 |
*,
|
| 2260 |
+
limit: int | None = None,
|
| 2261 |
+
before: str | None = None,
|
| 2262 |
+
after: str | None = None,
|
| 2263 |
+
order: PaginationOrder | str | None = "desc",
|
| 2264 |
+
request_options: RequestOptions | None = None,
|
| 2265 |
) -> AsyncPage[GroupRoleAssignment]:
|
| 2266 |
"""List role assignments for a group
|
| 2267 |
|
|
|
|
| 2308 |
group_id: str,
|
| 2309 |
*,
|
| 2310 |
role_slug: str,
|
| 2311 |
+
resource_id: str | None = None,
|
| 2312 |
+
resource_external_id: str | None = None,
|
| 2313 |
+
resource_type_slug: str | None = None,
|
| 2314 |
+
request_options: RequestOptions | None = None,
|
| 2315 |
) -> GroupRoleAssignment:
|
| 2316 |
"""Assign a role to a group
|
| 2317 |
|
|
|
|
| 2337 |
RateLimitExceededError: If rate limited (429).
|
| 2338 |
ServerError: If the server returns a 5xx error.
|
| 2339 |
"""
|
| 2340 |
+
body: dict[str, Any] = {
|
| 2341 |
k: v
|
| 2342 |
for k, v in {
|
| 2343 |
"role_slug": role_slug,
|
|
|
|
| 2359 |
self,
|
| 2360 |
group_id: str,
|
| 2361 |
*,
|
| 2362 |
+
role_assignments: list[ReplaceGroupRoleAssignmentEntry],
|
| 2363 |
+
request_options: RequestOptions | None = None,
|
| 2364 |
) -> GroupRoleAssignmentList:
|
| 2365 |
"""Replace all role assignments for a group
|
| 2366 |
|
|
|
|
| 2382 |
RateLimitExceededError: If rate limited (429).
|
| 2383 |
ServerError: If the server returns a 5xx error.
|
| 2384 |
"""
|
| 2385 |
+
body: dict[str, Any] = {
|
| 2386 |
"role_assignments": [item.to_dict() for item in role_assignments],
|
| 2387 |
}
|
| 2388 |
return await self._client.request(
|
|
|
|
| 2398 |
group_id: str,
|
| 2399 |
*,
|
| 2400 |
role_slug: str,
|
| 2401 |
+
resource_id: str | None = None,
|
| 2402 |
+
resource_external_id: str | None = None,
|
| 2403 |
+
resource_type_slug: str | None = None,
|
| 2404 |
+
request_options: RequestOptions | None = None,
|
| 2405 |
) -> None:
|
| 2406 |
"""Remove group role assignments by criteria
|
| 2407 |
|
|
|
|
| 2423 |
RateLimitExceededError: If rate limited (429).
|
| 2424 |
ServerError: If the server returns a 5xx error.
|
| 2425 |
"""
|
| 2426 |
+
body: dict[str, Any] = {
|
| 2427 |
k: v
|
| 2428 |
for k, v in {
|
| 2429 |
"role_slug": role_slug,
|
|
|
|
| 2445 |
group_id: str,
|
| 2446 |
role_assignment_id: str,
|
| 2447 |
*,
|
| 2448 |
+
request_options: RequestOptions | None = None,
|
| 2449 |
) -> GroupRoleAssignment:
|
| 2450 |
"""Get a group role assignment
|
| 2451 |
|
|
|
|
| 2484 |
group_id: str,
|
| 2485 |
role_assignment_id: str,
|
| 2486 |
*,
|
| 2487 |
+
request_options: RequestOptions | None = None,
|
| 2488 |
) -> None:
|
| 2489 |
"""Remove a group role assignment
|
| 2490 |
|
|
|
|
| 2519 |
organization_membership_id: str,
|
| 2520 |
*,
|
| 2521 |
permission_slug: str,
|
| 2522 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 2523 |
+
request_options: RequestOptions | None = None,
|
| 2524 |
) -> AuthorizationCheck:
|
| 2525 |
"""Check authorization
|
| 2526 |
|
|
|
|
| 2543 |
RateLimitExceededError: If rate limited (429).
|
| 2544 |
ServerError: If the server returns a 5xx error.
|
| 2545 |
"""
|
| 2546 |
+
body: dict[str, Any] = {
|
| 2547 |
"permission_slug": permission_slug,
|
| 2548 |
}
|
| 2549 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 2568 |
self,
|
| 2569 |
organization_membership_id: str,
|
| 2570 |
*,
|
| 2571 |
+
limit: int | None = None,
|
| 2572 |
+
before: str | None = None,
|
| 2573 |
+
after: str | None = None,
|
| 2574 |
+
order: PaginationOrder | str | None = "desc",
|
| 2575 |
permission_slug: str,
|
| 2576 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId,
|
| 2577 |
+
request_options: RequestOptions | None = None,
|
| 2578 |
) -> AsyncPage[AuthorizationResource]:
|
| 2579 |
"""List resources for organization membership
|
| 2580 |
|
|
|
|
| 2642 |
organization_membership_id: str,
|
| 2643 |
resource_id: str,
|
| 2644 |
*,
|
| 2645 |
+
limit: int | None = None,
|
| 2646 |
+
before: str | None = None,
|
| 2647 |
+
after: str | None = None,
|
| 2648 |
+
order: PaginationOrder | str | None = "desc",
|
| 2649 |
+
request_options: RequestOptions | None = None,
|
| 2650 |
) -> AsyncPage[AuthorizationPermission]:
|
| 2651 |
"""List effective permissions for an organization membership on a resource
|
| 2652 |
|
|
|
|
| 2703 |
resource_type_slug: str,
|
| 2704 |
external_id: str,
|
| 2705 |
*,
|
| 2706 |
+
limit: int | None = None,
|
| 2707 |
+
before: str | None = None,
|
| 2708 |
+
after: str | None = None,
|
| 2709 |
+
order: PaginationOrder | str | None = "desc",
|
| 2710 |
+
request_options: RequestOptions | None = None,
|
| 2711 |
) -> AsyncPage[AuthorizationPermission]:
|
| 2712 |
"""List effective permissions for an organization membership on a resource by external ID
|
| 2713 |
|
|
|
|
| 2764 |
self,
|
| 2765 |
organization_membership_id: str,
|
| 2766 |
*,
|
| 2767 |
+
limit: int | None = None,
|
| 2768 |
+
before: str | None = None,
|
| 2769 |
+
after: str | None = None,
|
| 2770 |
+
order: PaginationOrder | str | None = "desc",
|
| 2771 |
+
resource_id: str | None = None,
|
| 2772 |
+
resource_external_id: str | None = None,
|
| 2773 |
+
resource_type_slug: str | None = None,
|
| 2774 |
+
request_options: RequestOptions | None = None,
|
| 2775 |
) -> AsyncPage[UserRoleAssignment]:
|
| 2776 |
"""List role assignments
|
| 2777 |
|
|
|
|
| 2829 |
organization_membership_id: str,
|
| 2830 |
*,
|
| 2831 |
role_slug: str,
|
| 2832 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 2833 |
+
request_options: RequestOptions | None = None,
|
| 2834 |
) -> UserRoleAssignment:
|
| 2835 |
"""Assign a role
|
| 2836 |
|
|
|
|
| 2853 |
RateLimitExceededError: If rate limited (429).
|
| 2854 |
ServerError: If the server returns a 5xx error.
|
| 2855 |
"""
|
| 2856 |
+
body: dict[str, Any] = {
|
| 2857 |
"role_slug": role_slug,
|
| 2858 |
}
|
| 2859 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 2879 |
organization_membership_id: str,
|
| 2880 |
*,
|
| 2881 |
role_slug: str,
|
| 2882 |
+
resource_target: ResourceTargetById | ResourceTargetByExternalId,
|
| 2883 |
+
request_options: RequestOptions | None = None,
|
| 2884 |
) -> None:
|
| 2885 |
"""Remove a role assignment
|
| 2886 |
|
|
|
|
| 2900 |
RateLimitExceededError: If rate limited (429).
|
| 2901 |
ServerError: If the server returns a 5xx error.
|
| 2902 |
"""
|
| 2903 |
+
body: dict[str, Any] = {
|
| 2904 |
"role_slug": role_slug,
|
| 2905 |
}
|
| 2906 |
if isinstance(resource_target, ResourceTargetById):
|
|
|
|
| 2925 |
organization_membership_id: str,
|
| 2926 |
role_assignment_id: str,
|
| 2927 |
*,
|
| 2928 |
+
request_options: RequestOptions | None = None,
|
| 2929 |
) -> None:
|
| 2930 |
"""Remove a role assignment by ID
|
| 2931 |
|
|
|
|
| 2959 |
self,
|
| 2960 |
organization_id: str,
|
| 2961 |
*,
|
| 2962 |
+
request_options: RequestOptions | None = None,
|
| 2963 |
) -> RoleList:
|
| 2964 |
"""List custom roles
|
| 2965 |
|
|
|
|
| 2991 |
organization_id: str,
|
| 2992 |
*,
|
| 2993 |
name: str,
|
| 2994 |
+
slug: str | None = None,
|
| 2995 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 2996 |
+
resource_type_slug: str | None = None,
|
| 2997 |
+
request_options: RequestOptions | None = None,
|
| 2998 |
) -> Role:
|
| 2999 |
"""Create a custom role
|
| 3000 |
|
|
|
|
| 3021 |
RateLimitExceededError: If rate limited (429).
|
| 3022 |
ServerError: If the server returns a 5xx error.
|
| 3023 |
"""
|
| 3024 |
+
body: dict[str, Any] = {
|
| 3025 |
k: v
|
| 3026 |
for k, v in {
|
| 3027 |
"slug": slug,
|
|
|
|
| 3045 |
organization_id: str,
|
| 3046 |
slug: str,
|
| 3047 |
*,
|
| 3048 |
+
request_options: RequestOptions | None = None,
|
| 3049 |
) -> Role:
|
| 3050 |
"""Get a custom role
|
| 3051 |
|
|
|
|
| 3084 |
organization_id: str,
|
| 3085 |
slug: str,
|
| 3086 |
*,
|
| 3087 |
+
name: str | None = None,
|
| 3088 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 3089 |
+
request_options: RequestOptions | None = None,
|
| 3090 |
) -> Role:
|
| 3091 |
"""Update a custom role
|
| 3092 |
|
|
|
|
| 3111 |
RateLimitExceededError: If rate limited (429).
|
| 3112 |
ServerError: If the server returns a 5xx error.
|
| 3113 |
"""
|
| 3114 |
+
body: dict[str, Any] = {
|
| 3115 |
k: v
|
| 3116 |
for k, v in {
|
| 3117 |
"name": name,
|
|
|
|
| 3139 |
organization_id: str,
|
| 3140 |
slug: str,
|
| 3141 |
*,
|
| 3142 |
+
request_options: RequestOptions | None = None,
|
| 3143 |
) -> None:
|
| 3144 |
"""Delete a custom role
|
| 3145 |
|
|
|
|
| 3177 |
slug: str,
|
| 3178 |
*,
|
| 3179 |
body_slug: str,
|
| 3180 |
+
request_options: RequestOptions | None = None,
|
| 3181 |
) -> Role:
|
| 3182 |
"""Add a permission to a custom role
|
| 3183 |
|
|
|
|
| 3201 |
RateLimitExceededError: If rate limited (429).
|
| 3202 |
ServerError: If the server returns a 5xx error.
|
| 3203 |
"""
|
| 3204 |
+
body: dict[str, Any] = {
|
| 3205 |
"slug": body_slug,
|
| 3206 |
}
|
| 3207 |
return await self._client.request(
|
|
|
|
| 3224 |
organization_id: str,
|
| 3225 |
slug: str,
|
| 3226 |
*,
|
| 3227 |
+
permissions: list[str],
|
| 3228 |
+
request_options: RequestOptions | None = None,
|
| 3229 |
) -> Role:
|
| 3230 |
"""Set permissions for a custom role
|
| 3231 |
|
|
|
|
| 3248 |
RateLimitExceededError: If rate limited (429).
|
| 3249 |
ServerError: If the server returns a 5xx error.
|
| 3250 |
"""
|
| 3251 |
+
body: dict[str, Any] = {
|
| 3252 |
"permissions": permissions,
|
| 3253 |
}
|
| 3254 |
return await self._client.request(
|
|
|
|
| 3272 |
slug: str,
|
| 3273 |
permission_slug: str,
|
| 3274 |
*,
|
| 3275 |
+
request_options: RequestOptions | None = None,
|
| 3276 |
) -> None:
|
| 3277 |
"""Remove a permission from a custom role
|
| 3278 |
|
|
|
|
| 3311 |
resource_type_slug: str,
|
| 3312 |
external_id: str,
|
| 3313 |
*,
|
| 3314 |
+
request_options: RequestOptions | None = None,
|
| 3315 |
) -> AuthorizationResource:
|
| 3316 |
"""Get a resource by external ID
|
| 3317 |
|
|
|
|
| 3353 |
resource_type_slug: str,
|
| 3354 |
external_id: str,
|
| 3355 |
*,
|
| 3356 |
+
name: str | None = None,
|
| 3357 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 3358 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 3359 |
+
request_options: RequestOptions | None = None,
|
| 3360 |
) -> AuthorizationResource:
|
| 3361 |
"""Update a resource by external ID
|
| 3362 |
|
|
|
|
| 3384 |
RateLimitExceededError: If rate limited (429).
|
| 3385 |
ServerError: If the server returns a 5xx error.
|
| 3386 |
"""
|
| 3387 |
+
body: dict[str, Any] = {
|
| 3388 |
k: v
|
| 3389 |
for k, v in {
|
| 3390 |
"name": name,
|
|
|
|
| 3424 |
resource_type_slug: str,
|
| 3425 |
external_id: str,
|
| 3426 |
*,
|
| 3427 |
+
cascade_delete: bool | None = None,
|
| 3428 |
+
request_options: RequestOptions | None = None,
|
| 3429 |
) -> None:
|
| 3430 |
"""Delete an authorization resource by external ID
|
| 3431 |
|
|
|
|
| 3447 |
RateLimitExceededError: If rate limited (429).
|
| 3448 |
ServerError: If the server returns a 5xx error.
|
| 3449 |
"""
|
| 3450 |
+
params: dict[str, Any] = {
|
| 3451 |
k: v
|
| 3452 |
for k, v in {
|
| 3453 |
"cascade_delete": cascade_delete,
|
|
|
|
| 3474 |
resource_type_slug: str,
|
| 3475 |
external_id: str,
|
| 3476 |
*,
|
| 3477 |
+
limit: int | None = None,
|
| 3478 |
+
before: str | None = None,
|
| 3479 |
+
after: str | None = None,
|
| 3480 |
+
order: PaginationOrder | str | None = "desc",
|
| 3481 |
permission_slug: str,
|
| 3482 |
+
assignment: AuthorizationAssignment | str | None = None,
|
| 3483 |
+
request_options: RequestOptions | None = None,
|
| 3484 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 3485 |
"""List memberships for a resource by external ID
|
| 3486 |
|
|
|
|
| 3546 |
resource_type_slug: str,
|
| 3547 |
external_id: str,
|
| 3548 |
*,
|
| 3549 |
+
limit: int | None = None,
|
| 3550 |
+
before: str | None = None,
|
| 3551 |
+
after: str | None = None,
|
| 3552 |
+
order: PaginationOrder | str | None = "desc",
|
| 3553 |
+
role_slug: str | None = None,
|
| 3554 |
+
request_options: RequestOptions | None = None,
|
| 3555 |
) -> AsyncPage[UserRoleAssignment]:
|
| 3556 |
"""List role assignments for a resource by external ID
|
| 3557 |
|
|
|
|
| 3608 |
async def list_resources(
|
| 3609 |
self,
|
| 3610 |
*,
|
| 3611 |
+
limit: int | None = None,
|
| 3612 |
+
before: str | None = None,
|
| 3613 |
+
after: str | None = None,
|
| 3614 |
+
order: PaginationOrder | str | None = "desc",
|
| 3615 |
+
organization_id: str | None = None,
|
| 3616 |
+
resource_type_slug: str | None = None,
|
| 3617 |
+
resource_external_id: str | None = None,
|
| 3618 |
+
parent: ParentById | ParentByExternalId | None = None,
|
| 3619 |
+
request_options: RequestOptions | None = None,
|
| 3620 |
) -> AsyncPage[AuthorizationResource]:
|
| 3621 |
"""List resources
|
| 3622 |
|
|
|
|
| 3678 |
name: str,
|
| 3679 |
resource_type_slug: str,
|
| 3680 |
organization_id: str,
|
| 3681 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 3682 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 3683 |
+
request_options: RequestOptions | None = None,
|
| 3684 |
) -> AuthorizationResource:
|
| 3685 |
"""Create an authorization resource
|
| 3686 |
|
|
|
|
| 3708 |
RateLimitExceededError: If rate limited (429).
|
| 3709 |
ServerError: If the server returns a 5xx error.
|
| 3710 |
"""
|
| 3711 |
+
body: dict[str, Any] = {
|
| 3712 |
"external_id": external_id,
|
| 3713 |
"name": name,
|
| 3714 |
"resource_type_slug": resource_type_slug,
|
|
|
|
| 3738 |
self,
|
| 3739 |
resource_id: str,
|
| 3740 |
*,
|
| 3741 |
+
request_options: RequestOptions | None = None,
|
| 3742 |
) -> AuthorizationResource:
|
| 3743 |
"""Get a resource
|
| 3744 |
|
|
|
|
| 3770 |
self,
|
| 3771 |
resource_id: str,
|
| 3772 |
*,
|
| 3773 |
+
name: str | None = None,
|
| 3774 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
|
|
|
| 3775 |
+
parent_resource: ParentResourceById | ParentResourceByExternalId | None = None,
|
|
|
|
| 3776 |
+
request_options: RequestOptions | None = None,
|
| 3777 |
) -> AuthorizationResource:
|
| 3778 |
"""Update a resource
|
| 3779 |
|
|
|
|
| 3799 |
RateLimitExceededError: If rate limited (429).
|
| 3800 |
ServerError: If the server returns a 5xx error.
|
| 3801 |
"""
|
| 3802 |
+
body: dict[str, Any] = {
|
| 3803 |
k: v
|
| 3804 |
for k, v in {
|
| 3805 |
"name": name,
|
|
|
|
| 3830 |
self,
|
| 3831 |
resource_id: str,
|
| 3832 |
*,
|
| 3833 |
+
cascade_delete: bool | None = None,
|
| 3834 |
+
request_options: RequestOptions | None = None,
|
| 3835 |
) -> None:
|
| 3836 |
"""Delete an authorization resource
|
| 3837 |
|
|
|
|
| 3851 |
RateLimitExceededError: If rate limited (429).
|
| 3852 |
ServerError: If the server returns a 5xx error.
|
| 3853 |
"""
|
| 3854 |
+
params: dict[str, Any] = {
|
| 3855 |
k: v
|
| 3856 |
for k, v in {
|
| 3857 |
"cascade_delete": cascade_delete,
|
|
|
|
| 3869 |
self,
|
| 3870 |
resource_id: str,
|
| 3871 |
*,
|
| 3872 |
+
limit: int | None = None,
|
| 3873 |
+
before: str | None = None,
|
| 3874 |
+
after: str | None = None,
|
| 3875 |
+
order: PaginationOrder | str | None = "desc",
|
| 3876 |
permission_slug: str,
|
| 3877 |
+
assignment: AuthorizationAssignment | str | None = None,
|
| 3878 |
+
request_options: RequestOptions | None = None,
|
| 3879 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 3880 |
"""List organization memberships for resource
|
| 3881 |
|
|
|
|
| 3934 |
self,
|
| 3935 |
resource_id: str,
|
| 3936 |
*,
|
| 3937 |
+
limit: int | None = None,
|
| 3938 |
+
before: str | None = None,
|
| 3939 |
+
after: str | None = None,
|
| 3940 |
+
order: PaginationOrder | str | None = "desc",
|
| 3941 |
+
role_slug: str | None = None,
|
| 3942 |
+
request_options: RequestOptions | None = None,
|
| 3943 |
) -> AsyncPage[UserRoleAssignment]:
|
| 3944 |
"""List role assignments for a resource
|
| 3945 |
|
|
|
|
| 3986 |
async def list_environment_roles(
|
| 3987 |
self,
|
| 3988 |
*,
|
| 3989 |
+
request_options: RequestOptions | None = None,
|
| 3990 |
) -> RoleList:
|
| 3991 |
"""List environment roles
|
| 3992 |
|
|
|
|
| 4013 |
*,
|
| 4014 |
slug: str,
|
| 4015 |
name: str,
|
| 4016 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 4017 |
+
resource_type_slug: str | None = None,
|
| 4018 |
+
request_options: RequestOptions | None = None,
|
| 4019 |
) -> Role:
|
| 4020 |
"""Create an environment role
|
| 4021 |
|
|
|
|
| 4041 |
RateLimitExceededError: If rate limited (429).
|
| 4042 |
ServerError: If the server returns a 5xx error.
|
| 4043 |
"""
|
| 4044 |
+
body: dict[str, Any] = {
|
| 4045 |
k: v
|
| 4046 |
for k, v in {
|
| 4047 |
"slug": slug,
|
|
|
|
| 4064 |
self,
|
| 4065 |
slug: str,
|
| 4066 |
*,
|
| 4067 |
+
request_options: RequestOptions | None = None,
|
| 4068 |
) -> Role:
|
| 4069 |
"""Get an environment role
|
| 4070 |
|
|
|
|
| 4095 |
self,
|
| 4096 |
slug: str,
|
| 4097 |
*,
|
| 4098 |
+
name: str | None = None,
|
| 4099 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 4100 |
+
request_options: RequestOptions | None = None,
|
| 4101 |
) -> Role:
|
| 4102 |
"""Update an environment role
|
| 4103 |
|
|
|
|
| 4121 |
RateLimitExceededError: If rate limited (429).
|
| 4122 |
ServerError: If the server returns a 5xx error.
|
| 4123 |
"""
|
| 4124 |
+
body: dict[str, Any] = {
|
| 4125 |
k: v
|
| 4126 |
for k, v in {
|
| 4127 |
"name": name,
|
|
|
|
| 4143 |
slug: str,
|
| 4144 |
*,
|
| 4145 |
body_slug: str,
|
| 4146 |
+
request_options: RequestOptions | None = None,
|
| 4147 |
) -> Role:
|
| 4148 |
"""Add a permission to an environment role
|
| 4149 |
|
|
|
|
| 4166 |
RateLimitExceededError: If rate limited (429).
|
| 4167 |
ServerError: If the server returns a 5xx error.
|
| 4168 |
"""
|
| 4169 |
+
body: dict[str, Any] = {
|
| 4170 |
"slug": body_slug,
|
| 4171 |
}
|
| 4172 |
return await self._client.request(
|
|
|
|
| 4181 |
self,
|
| 4182 |
slug: str,
|
| 4183 |
*,
|
| 4184 |
+
permissions: list[str],
|
| 4185 |
+
request_options: RequestOptions | None = None,
|
| 4186 |
) -> Role:
|
| 4187 |
"""Set permissions for an environment role
|
| 4188 |
|
|
|
|
| 4205 |
RateLimitExceededError: If rate limited (429).
|
| 4206 |
ServerError: If the server returns a 5xx error.
|
| 4207 |
"""
|
| 4208 |
+
body: dict[str, Any] = {
|
| 4209 |
"permissions": permissions,
|
| 4210 |
}
|
| 4211 |
return await self._client.request(
|
|
|
|
| 4219 |
async def list_permissions(
|
| 4220 |
self,
|
| 4221 |
*,
|
| 4222 |
+
limit: int | None = None,
|
| 4223 |
+
before: str | None = None,
|
| 4224 |
+
after: str | None = None,
|
| 4225 |
+
order: PaginationOrder | str | None = "desc",
|
| 4226 |
+
request_options: RequestOptions | None = None,
|
| 4227 |
) -> AsyncPage[AuthorizationPermission]:
|
| 4228 |
"""List permissions
|
| 4229 |
|
|
|
|
| 4268 |
*,
|
| 4269 |
slug: str,
|
| 4270 |
name: str,
|
| 4271 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 4272 |
+
resource_type_slug: str | None = None,
|
| 4273 |
+
request_options: RequestOptions | None = None,
|
| 4274 |
) -> Permission:
|
| 4275 |
"""Create a permission
|
| 4276 |
|
|
|
|
| 4295 |
RateLimitExceededError: If rate limited (429).
|
| 4296 |
ServerError: If the server returns a 5xx error.
|
| 4297 |
"""
|
| 4298 |
+
body: dict[str, Any] = {
|
| 4299 |
k: v
|
| 4300 |
for k, v in {
|
| 4301 |
"slug": slug,
|
|
|
|
| 4318 |
self,
|
| 4319 |
slug: str,
|
| 4320 |
*,
|
| 4321 |
+
request_options: RequestOptions | None = None,
|
| 4322 |
) -> AuthorizationPermission:
|
| 4323 |
"""Get a permission
|
| 4324 |
|
|
|
|
| 4348 |
self,
|
| 4349 |
slug: str,
|
| 4350 |
*,
|
| 4351 |
+
name: str | None = None,
|
| 4352 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 4353 |
+
request_options: RequestOptions | None = None,
|
| 4354 |
) -> AuthorizationPermission:
|
| 4355 |
"""Update a permission
|
| 4356 |
|
|
|
|
| 4373 |
RateLimitExceededError: If rate limited (429).
|
| 4374 |
ServerError: If the server returns a 5xx error.
|
| 4375 |
"""
|
| 4376 |
+
body: dict[str, Any] = {
|
| 4377 |
k: v
|
| 4378 |
for k, v in {
|
| 4379 |
"name": name,
|
|
|
|
| 4394 |
self,
|
| 4395 |
slug: str,
|
| 4396 |
*,
|
| 4397 |
+
request_options: RequestOptions | None = None,
|
| 4398 |
) -> None:
|
| 4399 |
"""Delete a permission
|
| 4400 |
|
python/src/workos/authorization/models/assign_role.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,15 +14,15 @@ class AssignRole:
|
|
| 13 |
|
| 14 |
role_slug: str
|
| 15 |
"""The slug of the role to assign."""
|
| 16 |
-
resource_id:
|
| 17 |
"""The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`."""
|
| 18 |
-
resource_external_id:
|
| 19 |
"""The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`."""
|
| 20 |
-
resource_type_slug:
|
| 21 |
"""The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class AssignRole:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("AssignRole", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["role_slug"] = self.role_slug
|
| 40 |
if self.resource_id is not None:
|
| 41 |
result["resource_id"] = self.resource_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
role_slug: str
|
| 16 |
"""The slug of the role to assign."""
|
| 17 |
+
resource_id: str | None = None
|
| 18 |
"""The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`."""
|
| 19 |
+
resource_external_id: str | None = None
|
| 20 |
"""The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`."""
|
| 21 |
+
resource_type_slug: str | None = None
|
| 22 |
"""The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> AssignRole:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("AssignRole", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["role_slug"] = self.role_slug
|
| 41 |
if self.resource_id is not None:
|
| 42 |
result["resource_id"] = self.resource_id
|
python/src/workos/authorization/models/authorization_assignment.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class AuthorizationAssignment(str, Enum):
|
|
| 16 |
INDIRECT = "indirect"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
INDIRECT = "indirect"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> AuthorizationAssignment | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/authorization/models/authorization_check.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AuthorizationCheck:
|
|
| 15 |
"""Whether the organization membership has the specified permission on the resource."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AuthorizationCheck:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuthorizationCheck", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["authorized"] = self.authorized
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Whether the organization membership has the specified permission on the resource."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthorizationCheck:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuthorizationCheck", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["authorized"] = self.authorized
|
| 32 |
return result
|
python/src/workos/authorization/models/authorization_resource.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -17,11 +17,11 @@ class AuthorizationResource:
|
|
| 17 |
"""Distinguishes the Resource object."""
|
| 18 |
name: str
|
| 19 |
"""A human-readable name for the Resource."""
|
| 20 |
-
description:
|
| 21 |
"""An optional description of the Resource."""
|
| 22 |
organization_id: str
|
| 23 |
"""The ID of the organization that owns the resource."""
|
| 24 |
-
parent_resource_id:
|
| 25 |
"""The ID of the parent resource, if this resource is nested."""
|
| 26 |
id: str
|
| 27 |
"""The unique ID of the Resource."""
|
|
@@ -35,7 +35,7 @@ class AuthorizationResource:
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
-
def from_dict(cls, data:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
|
@@ -53,9 +53,9 @@ class AuthorizationResource:
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("AuthorizationResource", e)
|
| 55 |
|
| 56 |
-
def to_dict(self) ->
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
-
result:
|
| 59 |
result["object"] = self.object
|
| 60 |
result["name"] = self.name
|
| 61 |
if self.description is not None:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 17 |
"""Distinguishes the Resource object."""
|
| 18 |
name: str
|
| 19 |
"""A human-readable name for the Resource."""
|
| 20 |
+
description: str | None
|
| 21 |
"""An optional description of the Resource."""
|
| 22 |
organization_id: str
|
| 23 |
"""The ID of the organization that owns the resource."""
|
| 24 |
+
parent_resource_id: str | None
|
| 25 |
"""The ID of the parent resource, if this resource is nested."""
|
| 26 |
id: str
|
| 27 |
"""The unique ID of the Resource."""
|
|
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthorizationResource:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
|
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("AuthorizationResource", e)
|
| 55 |
|
| 56 |
+
def to_dict(self) -> dict[str, Any]:
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
+
result: dict[str, Any] = {}
|
| 59 |
result["object"] = self.object
|
| 60 |
result["name"] = self.name
|
| 61 |
if self.description is not None:
|
python/src/workos/authorization/models/check_authorization.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,15 +14,15 @@ class CheckAuthorization:
|
|
| 13 |
|
| 14 |
permission_slug: str
|
| 15 |
"""The slug of the permission to check."""
|
| 16 |
-
resource_id:
|
| 17 |
"""The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`."""
|
| 18 |
-
resource_external_id:
|
| 19 |
"""The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`."""
|
| 20 |
-
resource_type_slug:
|
| 21 |
"""The slug of the resource type. Required with `resource_external_id`. Mutually exclusive with `resource_id`."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class CheckAuthorization:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("CheckAuthorization", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["permission_slug"] = self.permission_slug
|
| 40 |
if self.resource_id is not None:
|
| 41 |
result["resource_id"] = self.resource_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
permission_slug: str
|
| 16 |
"""The slug of the permission to check."""
|
| 17 |
+
resource_id: str | None = None
|
| 18 |
"""The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`."""
|
| 19 |
+
resource_external_id: str | None = None
|
| 20 |
"""The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`."""
|
| 21 |
+
resource_type_slug: str | None = None
|
| 22 |
"""The slug of the resource type. Required with `resource_external_id`. Mutually exclusive with `resource_id`."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CheckAuthorization:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CheckAuthorization", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["permission_slug"] = self.permission_slug
|
| 41 |
if self.resource_id is not None:
|
| 42 |
result["resource_id"] = self.resource_id
|
python/src/workos/authorization/models/create_authorization_permission.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,13 +16,13 @@ class CreateAuthorizationPermission:
|
|
| 15 |
"""A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks."""
|
| 16 |
name: str
|
| 17 |
"""A descriptive name for the Permission."""
|
| 18 |
-
description:
|
| 19 |
"""An optional description of the Permission."""
|
| 20 |
-
resource_type_slug:
|
| 21 |
"""The slug of the resource type this permission is scoped to."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class CreateAuthorizationPermission:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("CreateAuthorizationPermission", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["slug"] = self.slug
|
| 40 |
result["name"] = self.name
|
| 41 |
if self.description is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks."""
|
| 17 |
name: str
|
| 18 |
"""A descriptive name for the Permission."""
|
| 19 |
+
description: str | None = None
|
| 20 |
"""An optional description of the Permission."""
|
| 21 |
+
resource_type_slug: str | None = None
|
| 22 |
"""The slug of the resource type this permission is scoped to."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateAuthorizationPermission:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateAuthorizationPermission", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["slug"] = self.slug
|
| 41 |
result["name"] = self.name
|
| 42 |
if self.description is not None:
|
python/src/workos/authorization/models/create_authorization_resource.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,17 +20,17 @@ class CreateAuthorizationResource:
|
|
| 19 |
"""The slug of the resource type."""
|
| 20 |
organization_id: str
|
| 21 |
"""The ID of the organization this resource belongs to."""
|
| 22 |
-
description:
|
| 23 |
"""An optional description of the resource."""
|
| 24 |
-
parent_resource_id:
|
| 25 |
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
|
| 26 |
-
parent_resource_external_id:
|
| 27 |
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
|
| 28 |
-
parent_resource_type_slug:
|
| 29 |
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -45,9 +46,9 @@ class CreateAuthorizationResource:
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("CreateAuthorizationResource", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["external_id"] = self.external_id
|
| 52 |
result["name"] = self.name
|
| 53 |
result["resource_type_slug"] = self.resource_type_slug
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The slug of the resource type."""
|
| 21 |
organization_id: str
|
| 22 |
"""The ID of the organization this resource belongs to."""
|
| 23 |
+
description: str | None = None
|
| 24 |
"""An optional description of the resource."""
|
| 25 |
+
parent_resource_id: str | None = None
|
| 26 |
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
|
| 27 |
+
parent_resource_external_id: str | None = None
|
| 28 |
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
|
| 29 |
+
parent_resource_type_slug: str | None = None
|
| 30 |
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateAuthorizationResource:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("CreateAuthorizationResource", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["external_id"] = self.external_id
|
| 53 |
result["name"] = self.name
|
| 54 |
result["resource_type_slug"] = self.resource_type_slug
|
python/src/workos/authorization/models/create_organization_role.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,15 +14,15 @@ class CreateOrganizationRole:
|
|
| 13 |
|
| 14 |
name: str
|
| 15 |
"""A descriptive name for the role."""
|
| 16 |
-
slug:
|
| 17 |
"""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:
|
| 19 |
"""An optional description of the role's purpose."""
|
| 20 |
-
resource_type_slug:
|
| 21 |
"""The slug of the resource type the role is scoped to."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class CreateOrganizationRole:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("CreateOrganizationRole", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["name"] = self.name
|
| 40 |
if self.slug is not None:
|
| 41 |
result["slug"] = self.slug
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
name: str
|
| 16 |
"""A descriptive name for the role."""
|
| 17 |
+
slug: str | None = None
|
| 18 |
"""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."""
|
| 19 |
+
description: str | None = None
|
| 20 |
"""An optional description of the role's purpose."""
|
| 21 |
+
resource_type_slug: str | None = None
|
| 22 |
"""The slug of the resource type the role is scoped to."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationRole:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateOrganizationRole", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["name"] = self.name
|
| 41 |
if self.slug is not None:
|
| 42 |
result["slug"] = self.slug
|
python/src/workos/authorization/models/group_role_assignment.py|
@@ -4,14 +4,13 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
-
from .
|
| 13 |
from workos.common.models.slim_role import SlimRole
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
@dataclass(slots=True)
|
| 17 |
class GroupRoleAssignment:
|
|
@@ -23,9 +22,9 @@ class GroupRoleAssignment:
|
|
| 23 |
"""Unique identifier of the group role assignment."""
|
| 24 |
group_id: str
|
| 25 |
"""The ID of the group the role is assigned to."""
|
| 26 |
-
role:
|
| 27 |
"""The role included in the assignment."""
|
| 28 |
-
resource:
|
| 29 |
"""The resource the role is assigned on."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
@@ -33,16 +32,16 @@ class GroupRoleAssignment:
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
| 40 |
object=data.get("object", "group_role_assignment"),
|
| 41 |
id=data["id"],
|
| 42 |
group_id=data["group_id"],
|
| 43 |
-
role=SlimRole.from_dict(cast(
|
| 44 |
resource=GroupRoleAssignmentResource.from_dict(
|
| 45 |
-
cast(
|
| 46 |
),
|
| 47 |
created_at=_parse_datetime(data["created_at"]),
|
| 48 |
updated_at=_parse_datetime(data["updated_at"]),
|
|
@@ -50,9 +49,9 @@ class GroupRoleAssignment:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("GroupRoleAssignment", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["group_id"] = self.group_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
from workos.common.models.slim_role import SlimRole
|
| 11 |
|
| 12 |
+
from .group_role_assignment_resource import GroupRoleAssignmentResource
|
| 13 |
+
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
| 16 |
class GroupRoleAssignment:
|
|
|
|
| 22 |
"""Unique identifier of the group role assignment."""
|
| 23 |
group_id: str
|
| 24 |
"""The ID of the group the role is assigned to."""
|
| 25 |
+
role: SlimRole
|
| 26 |
"""The role included in the assignment."""
|
| 27 |
+
resource: GroupRoleAssignmentResource
|
| 28 |
"""The resource the role is assigned on."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupRoleAssignment:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
| 39 |
object=data.get("object", "group_role_assignment"),
|
| 40 |
id=data["id"],
|
| 41 |
group_id=data["group_id"],
|
| 42 |
+
role=SlimRole.from_dict(cast(dict[str, Any], data["role"])),
|
| 43 |
resource=GroupRoleAssignmentResource.from_dict(
|
| 44 |
+
cast(dict[str, Any], data["resource"])
|
| 45 |
),
|
| 46 |
created_at=_parse_datetime(data["created_at"]),
|
| 47 |
updated_at=_parse_datetime(data["updated_at"]),
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("GroupRoleAssignment", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["group_id"] = self.group_id
|
python/src/workos/authorization/models/group_role_assignment_list.py|
@@ -3,12 +3,12 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
|
| 10 |
from .group_role_assignment import GroupRoleAssignment
|
| 11 |
-
from workos.common.models.list_metadata import ListMetadata
|
| 12 |
|
| 13 |
|
| 14 |
@dataclass(slots=True)
|
|
@@ -17,30 +17,30 @@ class GroupRoleAssignmentList:
|
|
| 17 |
|
| 18 |
object: Literal["list"]
|
| 19 |
"""Indicates this is a list response."""
|
| 20 |
-
data:
|
| 21 |
"""The list of records for the current page."""
|
| 22 |
-
list_metadata:
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def from_dict(cls, data:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
| 29 |
object=data.get("object", "list"),
|
| 30 |
data=[
|
| 31 |
-
GroupRoleAssignment.from_dict(cast(
|
| 32 |
for item in cast(list[Any], data["data"])
|
| 33 |
],
|
| 34 |
list_metadata=ListMetadata.from_dict(
|
| 35 |
-
cast(
|
| 36 |
),
|
| 37 |
)
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("GroupRoleAssignmentList", e)
|
| 40 |
|
| 41 |
-
def to_dict(self) ->
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
-
result:
|
| 44 |
result["object"] = self.object
|
| 45 |
result["data"] = [item.to_dict() for item in self.data]
|
| 46 |
result["list_metadata"] = self.list_metadata.to_dict()
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
+
from workos.common.models.list_metadata import ListMetadata
|
| 10 |
|
| 11 |
from .group_role_assignment import GroupRoleAssignment
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
@dataclass(slots=True)
|
|
|
|
| 17 |
|
| 18 |
object: Literal["list"]
|
| 19 |
"""Indicates this is a list response."""
|
| 20 |
+
data: list[GroupRoleAssignment]
|
| 21 |
"""The list of records for the current page."""
|
| 22 |
+
list_metadata: ListMetadata
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupRoleAssignmentList:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
| 29 |
object=data.get("object", "list"),
|
| 30 |
data=[
|
| 31 |
+
GroupRoleAssignment.from_dict(cast(dict[str, Any], item))
|
| 32 |
for item in cast(list[Any], data["data"])
|
| 33 |
],
|
| 34 |
list_metadata=ListMetadata.from_dict(
|
| 35 |
+
cast(dict[str, Any], data["list_metadata"])
|
| 36 |
),
|
| 37 |
)
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("GroupRoleAssignmentList", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["object"] = self.object
|
| 45 |
result["data"] = [item.to_dict() for item in self.data]
|
| 46 |
result["list_metadata"] = self.list_metadata.to_dict()
|
python/src/workos/authorization/models/group_role_assignment_resource.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,7 +20,7 @@ class GroupRoleAssignmentResource:
|
|
| 19 |
"""The slug of the resource type this resource belongs to."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class GroupRoleAssignmentResource:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("GroupRoleAssignmentResource", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["id"] = self.id
|
| 37 |
result["external_id"] = self.external_id
|
| 38 |
result["resource_type_slug"] = self.resource_type_slug
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The slug of the resource type this resource belongs to."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupRoleAssignmentResource:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("GroupRoleAssignmentResource", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["id"] = self.id
|
| 38 |
result["external_id"] = self.external_id
|
| 39 |
result["resource_type_slug"] = self.resource_type_slug
|
python/src/workos/authorization/models/replace_group_role_assignments.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .replace_group_role_assignment_entry import ReplaceGroupRoleAssignmentEntry
|
|
@@ -14,17 +14,17 @@ from .replace_group_role_assignment_entry import ReplaceGroupRoleAssignmentEntry
|
|
| 14 |
class ReplaceGroupRoleAssignments:
|
| 15 |
"""Replace Group Role Assignments model."""
|
| 16 |
|
| 17 |
-
role_assignments:
|
| 18 |
"""The list of role assignments that should exist for the group. All existing assignments will be replaced."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def from_dict(cls, data:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
| 25 |
role_assignments=[
|
| 26 |
ReplaceGroupRoleAssignmentEntry.from_dict(
|
| 27 |
-
cast(
|
| 28 |
)
|
| 29 |
for item in cast(list[Any], data["role_assignments"])
|
| 30 |
],
|
|
@@ -32,8 +32,8 @@ class ReplaceGroupRoleAssignments:
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("ReplaceGroupRoleAssignments", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["role_assignments"] = [item.to_dict() for item in self.role_assignments]
|
| 39 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .replace_group_role_assignment_entry import ReplaceGroupRoleAssignmentEntry
|
|
|
|
| 14 |
class ReplaceGroupRoleAssignments:
|
| 15 |
"""Replace Group Role Assignments model."""
|
| 16 |
|
| 17 |
+
role_assignments: list[ReplaceGroupRoleAssignmentEntry]
|
| 18 |
"""The list of role assignments that should exist for the group. All existing assignments will be replaced."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> ReplaceGroupRoleAssignments:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
| 25 |
role_assignments=[
|
| 26 |
ReplaceGroupRoleAssignmentEntry.from_dict(
|
| 27 |
+
cast(dict[str, Any], item)
|
| 28 |
)
|
| 29 |
for item in cast(list[Any], data["role_assignments"])
|
| 30 |
],
|
|
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("ReplaceGroupRoleAssignments", e)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["role_assignments"] = [item.to_dict() for item in self.role_assignments]
|
| 39 |
return result
|
python/src/workos/authorization/models/role.py|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
from workos.common.models.role_type import RoleType
|
| 12 |
|
| 13 |
|
|
@@ -23,13 +23,13 @@ class Role:
|
|
| 23 |
"""Unique identifier of the role."""
|
| 24 |
name: str
|
| 25 |
"""A descriptive name for the role."""
|
| 26 |
-
description:
|
| 27 |
"""An optional description of the role."""
|
| 28 |
-
type:
|
| 29 |
"""Whether the role is scoped to the environment or an organization (custom role)."""
|
| 30 |
resource_type_slug: str
|
| 31 |
"""The slug of the resource type the role is scoped to."""
|
| 32 |
-
permissions:
|
| 33 |
"""The permission slugs assigned to the role."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
@@ -37,7 +37,7 @@ class Role:
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
-
def from_dict(cls, data:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
@@ -55,9 +55,9 @@ class Role:
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("Role", e)
|
| 57 |
|
| 58 |
-
def to_dict(self) ->
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
-
result:
|
| 61 |
result["slug"] = self.slug
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.role_type import RoleType
|
| 12 |
|
| 13 |
|
|
|
|
| 23 |
"""Unique identifier of the role."""
|
| 24 |
name: str
|
| 25 |
"""A descriptive name for the role."""
|
| 26 |
+
description: str | None
|
| 27 |
"""An optional description of the role."""
|
| 28 |
+
type: RoleType
|
| 29 |
"""Whether the role is scoped to the environment or an organization (custom role)."""
|
| 30 |
resource_type_slug: str
|
| 31 |
"""The slug of the resource type the role is scoped to."""
|
| 32 |
+
permissions: list[str]
|
| 33 |
"""The permission slugs assigned to the role."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
+
def from_dict(cls, data: dict[str, Any]) -> Role:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("Role", e)
|
| 57 |
|
| 58 |
+
def to_dict(self) -> dict[str, Any]:
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
+
result: dict[str, Any] = {}
|
| 61 |
result["slug"] = self.slug
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
python/src/workos/authorization/models/role_list.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .role import Role
|
|
@@ -15,26 +15,26 @@ class RoleList:
|
|
| 15 |
"""Role List model."""
|
| 16 |
|
| 17 |
object: Literal["list"]
|
| 18 |
-
data:
|
| 19 |
"""The list of records for the current page."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
| 26 |
object=data.get("object", "list"),
|
| 27 |
data=[
|
| 28 |
-
Role.from_dict(cast(
|
| 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) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["object"] = self.object
|
| 39 |
result["data"] = [item.to_dict() for item in self.data]
|
| 40 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .role import Role
|
|
|
|
| 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.get("object", "list"),
|
| 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
|
python/src/workos/authorization/models/set_role_permissions.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class SetRolePermissions:
|
| 12 |
"""Set Role Permissions model."""
|
| 13 |
|
| 14 |
-
permissions:
|
| 15 |
"""The permission slugs to assign to the role."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class SetRolePermissions:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("SetRolePermissions", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["permissions"] = self.permissions
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class SetRolePermissions:
|
| 13 |
"""Set Role Permissions model."""
|
| 14 |
|
| 15 |
+
permissions: list[str]
|
| 16 |
"""The permission slugs to assign to the role."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> SetRolePermissions:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("SetRolePermissions", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["permissions"] = self.permissions
|
| 32 |
return result
|
python/src/workos/authorization/models/update_authorization_permission.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,13 +12,13 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class UpdateAuthorizationPermission:
|
| 12 |
"""Update Authorization Permission model."""
|
| 13 |
|
| 14 |
-
name:
|
| 15 |
"""A descriptive name for the Permission."""
|
| 16 |
-
description:
|
| 17 |
"""An optional description of the Permission."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class UpdateAuthorizationPermission:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("UpdateAuthorizationPermission", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
if self.name is not None:
|
| 34 |
result["name"] = self.name
|
| 35 |
if self.description is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class UpdateAuthorizationPermission:
|
| 13 |
"""Update Authorization Permission model."""
|
| 14 |
|
| 15 |
+
name: str | None = None
|
| 16 |
"""A descriptive name for the Permission."""
|
| 17 |
+
description: str | None = None
|
| 18 |
"""An optional description of the Permission."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateAuthorizationPermission:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("UpdateAuthorizationPermission", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.name is not None:
|
| 35 |
result["name"] = self.name
|
| 36 |
if self.description is not None:
|
python/src/workos/authorization/models/update_authorization_resource.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,19 +12,19 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class UpdateAuthorizationResource:
|
| 12 |
"""Update Authorization Resource model."""
|
| 13 |
|
| 14 |
-
name:
|
| 15 |
"""A display name for the resource."""
|
| 16 |
-
description:
|
| 17 |
"""An optional description of the resource."""
|
| 18 |
-
parent_resource_id:
|
| 19 |
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
|
| 20 |
-
parent_resource_external_id:
|
| 21 |
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
|
| 22 |
-
parent_resource_type_slug:
|
| 23 |
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -36,9 +37,9 @@ class UpdateAuthorizationResource:
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("UpdateAuthorizationResource", e)
|
| 38 |
|
| 39 |
-
def to_dict(self) ->
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
-
result:
|
| 42 |
if self.name is not None:
|
| 43 |
result["name"] = self.name
|
| 44 |
if self.description is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class UpdateAuthorizationResource:
|
| 13 |
"""Update Authorization Resource model."""
|
| 14 |
|
| 15 |
+
name: str | None = None
|
| 16 |
"""A display name for the resource."""
|
| 17 |
+
description: str | None = None
|
| 18 |
"""An optional description of the resource."""
|
| 19 |
+
parent_resource_id: str | None = None
|
| 20 |
"""The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`."""
|
| 21 |
+
parent_resource_external_id: str | None = None
|
| 22 |
"""The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`."""
|
| 23 |
+
parent_resource_type_slug: str | None = None
|
| 24 |
"""The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateAuthorizationResource:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("UpdateAuthorizationResource", e)
|
| 39 |
|
| 40 |
+
def to_dict(self) -> dict[str, Any]:
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
+
result: dict[str, Any] = {}
|
| 43 |
if self.name is not None:
|
| 44 |
result["name"] = self.name
|
| 45 |
if self.description is not None:
|
python/src/workos/authorization/models/user_role_assignment.py|
@@ -4,12 +4,11 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
|
|
|
| 12 |
from workos.common.models.slim_role import SlimRole
|
|
|
|
| 13 |
from .user_role_assignment_resource import UserRoleAssignmentResource
|
| 14 |
from .user_role_assignment_source import UserRoleAssignmentSource
|
| 15 |
|
|
@@ -24,11 +23,11 @@ class UserRoleAssignment:
|
|
| 24 |
"""Unique identifier of the role assignment."""
|
| 25 |
organization_membership_id: str
|
| 26 |
"""The ID of the organization membership the role is assigned to."""
|
| 27 |
-
role:
|
| 28 |
"""The role included in the assignment."""
|
| 29 |
-
resource:
|
| 30 |
"""The resource the role is assigned on."""
|
| 31 |
-
source:
|
| 32 |
"""The origin of the role assignment."""
|
| 33 |
created_at: datetime
|
| 34 |
"""An ISO 8601 timestamp."""
|
|
@@ -36,19 +35,19 @@ class UserRoleAssignment:
|
|
| 36 |
"""An ISO 8601 timestamp."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
-
def from_dict(cls, data:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
return cls(
|
| 43 |
object=data.get("object", "role_assignment"),
|
| 44 |
id=data["id"],
|
| 45 |
organization_membership_id=data["organization_membership_id"],
|
| 46 |
-
role=SlimRole.from_dict(cast(
|
| 47 |
resource=UserRoleAssignmentResource.from_dict(
|
| 48 |
-
cast(
|
| 49 |
),
|
| 50 |
source=UserRoleAssignmentSource.from_dict(
|
| 51 |
-
cast(
|
| 52 |
),
|
| 53 |
created_at=_parse_datetime(data["created_at"]),
|
| 54 |
updated_at=_parse_datetime(data["updated_at"]),
|
|
@@ -56,9 +55,9 @@ class UserRoleAssignment:
|
|
| 56 |
except (KeyError, ValueError) as e:
|
| 57 |
_raise_deserialize_error("UserRoleAssignment", e)
|
| 58 |
|
| 59 |
-
def to_dict(self) ->
|
| 60 |
"""Serialize to a dictionary."""
|
| 61 |
-
result:
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
| 64 |
result["organization_membership_id"] = self.organization_membership_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
from workos.common.models.slim_role import SlimRole
|
| 11 |
+
|
| 12 |
from .user_role_assignment_resource import UserRoleAssignmentResource
|
| 13 |
from .user_role_assignment_source import UserRoleAssignmentSource
|
| 14 |
|
|
|
|
| 23 |
"""Unique identifier of the role assignment."""
|
| 24 |
organization_membership_id: str
|
| 25 |
"""The ID of the organization membership the role is assigned to."""
|
| 26 |
+
role: SlimRole
|
| 27 |
"""The role included in the assignment."""
|
| 28 |
+
resource: UserRoleAssignmentResource
|
| 29 |
"""The resource the role is assigned on."""
|
| 30 |
+
source: UserRoleAssignmentSource
|
| 31 |
"""The origin of the role assignment."""
|
| 32 |
created_at: datetime
|
| 33 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
+
def from_dict(cls, data: dict[str, Any]) -> UserRoleAssignment:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
| 42 |
object=data.get("object", "role_assignment"),
|
| 43 |
id=data["id"],
|
| 44 |
organization_membership_id=data["organization_membership_id"],
|
| 45 |
+
role=SlimRole.from_dict(cast(dict[str, Any], data["role"])),
|
| 46 |
resource=UserRoleAssignmentResource.from_dict(
|
| 47 |
+
cast(dict[str, Any], data["resource"])
|
| 48 |
),
|
| 49 |
source=UserRoleAssignmentSource.from_dict(
|
| 50 |
+
cast(dict[str, Any], data["source"])
|
| 51 |
),
|
| 52 |
created_at=_parse_datetime(data["created_at"]),
|
| 53 |
updated_at=_parse_datetime(data["updated_at"]),
|
|
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("UserRoleAssignment", e)
|
| 57 |
|
| 58 |
+
def to_dict(self) -> dict[str, Any]:
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
+
result: dict[str, Any] = {}
|
| 61 |
result["object"] = self.object
|
| 62 |
result["id"] = self.id
|
| 63 |
result["organization_membership_id"] = self.organization_membership_id
|
python/src/workos/authorization/models/user_role_assignment_source.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.user_role_assignment_source_type import (
|
| 10 |
UserRoleAssignmentSourceType,
|
|
@@ -15,13 +16,13 @@ from workos.common.models.user_role_assignment_source_type import (
|
|
| 15 |
class UserRoleAssignmentSource:
|
| 16 |
"""The origin of the role assignment."""
|
| 17 |
|
| 18 |
-
type:
|
| 19 |
"""Whether the role was assigned directly or derived from a group."""
|
| 20 |
-
group_role_assignment_id:
|
| 21 |
"""The ID of the group role assignment the role was derived from, or null if direct."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -31,9 +32,9 @@ class UserRoleAssignmentSource:
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("UserRoleAssignmentSource", e)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 38 |
if self.group_role_assignment_id is not None:
|
| 39 |
result["group_role_assignment_id"] = self.group_role_assignment_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.user_role_assignment_source_type import (
|
| 11 |
UserRoleAssignmentSourceType,
|
|
|
|
| 16 |
class UserRoleAssignmentSource:
|
| 17 |
"""The origin of the role assignment."""
|
| 18 |
|
| 19 |
+
type: UserRoleAssignmentSourceType
|
| 20 |
"""Whether the role was assigned directly or derived from a group."""
|
| 21 |
+
group_role_assignment_id: str | None
|
| 22 |
"""The ID of the group role assignment the role was derived from, or null if direct."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> UserRoleAssignmentSource:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("UserRoleAssignmentSource", e)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 39 |
if self.group_role_assignment_id is not None:
|
| 40 |
result["group_role_assignment_id"] = self.group_role_assignment_id
|
python/src/workos/client_api/_resource.py|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
|
@@ -14,7 +14,7 @@ from .models import ClientApiTokenResponse
|
|
| 14 |
class ClientApi:
|
| 15 |
"""Client Api API resources."""
|
| 16 |
|
| 17 |
-
def __init__(self, client:
|
| 18 |
self._client = client
|
| 19 |
|
| 20 |
def create_token(
|
|
@@ -22,7 +22,7 @@ class ClientApi:
|
|
| 22 |
*,
|
| 23 |
organization_id: str,
|
| 24 |
user_id: str,
|
| 25 |
-
request_options:
|
| 26 |
) -> ClientApiTokenResponse:
|
| 27 |
"""Generate a Client API token
|
| 28 |
|
|
@@ -44,7 +44,7 @@ class ClientApi:
|
|
| 44 |
RateLimitExceededError: If rate limited (429).
|
| 45 |
ServerError: If the server returns a 5xx error.
|
| 46 |
"""
|
| 47 |
-
body:
|
| 48 |
"organization_id": organization_id,
|
| 49 |
"user_id": user_id,
|
| 50 |
}
|
|
@@ -60,7 +60,7 @@ class ClientApi:
|
|
| 60 |
class AsyncClientApi:
|
| 61 |
"""Client Api API resources (async)."""
|
| 62 |
|
| 63 |
-
def __init__(self, client:
|
| 64 |
self._client = client
|
| 65 |
|
| 66 |
async def create_token(
|
|
@@ -68,7 +68,7 @@ class AsyncClientApi:
|
|
| 68 |
*,
|
| 69 |
organization_id: str,
|
| 70 |
user_id: str,
|
| 71 |
-
request_options:
|
| 72 |
) -> ClientApiTokenResponse:
|
| 73 |
"""Generate a Client API token
|
| 74 |
|
|
@@ -90,7 +90,7 @@ class AsyncClientApi:
|
|
| 90 |
RateLimitExceededError: If rate limited (429).
|
| 91 |
ServerError: If the server returns a 5xx error.
|
| 92 |
"""
|
| 93 |
-
body:
|
| 94 |
"organization_id": organization_id,
|
| 95 |
"user_id": user_id,
|
| 96 |
}
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
|
|
|
| 14 |
class ClientApi:
|
| 15 |
"""Client Api API resources."""
|
| 16 |
|
| 17 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 18 |
self._client = client
|
| 19 |
|
| 20 |
def create_token(
|
|
|
|
| 22 |
*,
|
| 23 |
organization_id: str,
|
| 24 |
user_id: str,
|
| 25 |
+
request_options: RequestOptions | None = None,
|
| 26 |
) -> ClientApiTokenResponse:
|
| 27 |
"""Generate a Client API token
|
| 28 |
|
|
|
|
| 44 |
RateLimitExceededError: If rate limited (429).
|
| 45 |
ServerError: If the server returns a 5xx error.
|
| 46 |
"""
|
| 47 |
+
body: dict[str, Any] = {
|
| 48 |
"organization_id": organization_id,
|
| 49 |
"user_id": user_id,
|
| 50 |
}
|
|
|
|
| 60 |
class AsyncClientApi:
|
| 61 |
"""Client Api API resources (async)."""
|
| 62 |
|
| 63 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 64 |
self._client = client
|
| 65 |
|
| 66 |
async def create_token(
|
|
|
|
| 68 |
*,
|
| 69 |
organization_id: str,
|
| 70 |
user_id: str,
|
| 71 |
+
request_options: RequestOptions | None = None,
|
| 72 |
) -> ClientApiTokenResponse:
|
| 73 |
"""Generate a Client API token
|
| 74 |
|
|
|
|
| 90 |
RateLimitExceededError: If rate limited (429).
|
| 91 |
ServerError: If the server returns a 5xx error.
|
| 92 |
"""
|
| 93 |
+
body: dict[str, Any] = {
|
| 94 |
"organization_id": organization_id,
|
| 95 |
"user_id": user_id,
|
| 96 |
}
|
python/src/workos/client_api/models/client_api_token.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class ClientApiToken:
|
|
| 17 |
"""The ID of the user to issue the Client API token for."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class ClientApiToken:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("ClientApiToken", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["organization_id"] = self.organization_id
|
| 34 |
result["user_id"] = self.user_id
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The ID of the user to issue the Client API token for."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> ClientApiToken:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ClientApiToken", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["organization_id"] = self.organization_id
|
| 35 |
result["user_id"] = self.user_id
|
| 36 |
return result
|
python/src/workos/client_api/models/client_api_token_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class ClientApiTokenResponse:
|
|
| 15 |
"""The Client API token."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class ClientApiTokenResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("ClientApiTokenResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["token"] = self.token
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The Client API token."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> ClientApiTokenResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("ClientApiTokenResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["token"] = self.token
|
| 32 |
return result
|
python/src/workos/common/__init__.py|
@@ -1,6 +1,5 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
-
from .models import *
|
| 4 |
from .models import (
|
| 5 |
AccessTokenAgentRegistrationCredentialIssuedDataDetail as AccessTokenAgentRegistrationCredentialIssuedDataDetail,
|
| 6 |
)
|
|
@@ -51,6 +50,8 @@ from .models import (
|
|
| 51 |
from .models import (
|
| 52 |
AgentRegistrationOrganizationSwitchedData as AgentRegistrationOrganizationSwitchedData,
|
| 53 |
)
|
|
|
|
|
|
|
| 54 |
from .models import AgentRegistrationRevoked as AgentRegistrationRevoked
|
| 55 |
from .models import AgentRegistrationRevokedData as AgentRegistrationRevokedData
|
| 56 |
from .models import AgentRegistrationStatus as AgentRegistrationStatus
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
|
|
|
| 3 |
from .models import (
|
| 4 |
AccessTokenAgentRegistrationCredentialIssuedDataDetail as AccessTokenAgentRegistrationCredentialIssuedDataDetail,
|
| 5 |
)
|
|
|
|
| 50 |
from .models import (
|
| 51 |
AgentRegistrationOrganizationSwitchedData as AgentRegistrationOrganizationSwitchedData,
|
| 52 |
)
|
| 53 |
+
from .models import AgentRegistrationRefreshed as AgentRegistrationRefreshed
|
| 54 |
+
from .models import AgentRegistrationRefreshedData as AgentRegistrationRefreshedData
|
| 55 |
from .models import AgentRegistrationRevoked as AgentRegistrationRevoked
|
| 56 |
from .models import AgentRegistrationRevokedData as AgentRegistrationRevokedData
|
| 57 |
from .models import AgentRegistrationStatus as AgentRegistrationStatus
|
python/src/workos/common/models/__init__.py|
@@ -44,9 +44,6 @@ from .agent_registration_created_data import (
|
|
| 44 |
from .agent_registration_created_data_agent_identity import (
|
| 45 |
AgentRegistrationCreatedDataAgentIdentity as AgentRegistrationCreatedDataAgentIdentity,
|
| 46 |
)
|
| 47 |
-
from .agent_registration_created_data_kind import *
|
| 48 |
-
from .agent_registration_created_data_method import *
|
| 49 |
-
from .agent_registration_created_data_status import *
|
| 50 |
from .agent_registration_credential_issued import (
|
| 51 |
AgentRegistrationCredentialIssued as AgentRegistrationCredentialIssued,
|
| 52 |
)
|
|
@@ -75,6 +72,12 @@ from .agent_registration_organization_switched import (
|
|
| 75 |
from .agent_registration_organization_switched_data import (
|
| 76 |
AgentRegistrationOrganizationSwitchedData as AgentRegistrationOrganizationSwitchedData,
|
| 77 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
from .agent_registration_revoked import (
|
| 79 |
AgentRegistrationRevoked as AgentRegistrationRevoked,
|
| 80 |
)
|
|
@@ -237,7 +240,6 @@ from .authentication_radar_risk_detected import (
|
|
| 237 |
from .authentication_radar_risk_detected_data import (
|
| 238 |
AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData,
|
| 239 |
)
|
| 240 |
-
from .authentication_radar_risk_detected_data_action import *
|
| 241 |
from .authentication_reauthentication_succeeded import (
|
| 242 |
AuthenticationReauthenticationSucceeded as AuthenticationReauthenticationSucceeded,
|
| 243 |
)
|
|
@@ -312,26 +314,18 @@ from .connection_activated import ConnectionActivated as ConnectionActivated
|
|
| 312 |
from .connection_activated_data import (
|
| 313 |
ConnectionActivatedData as ConnectionActivatedData,
|
| 314 |
)
|
| 315 |
-
from .connection_activated_data_connection_type import *
|
| 316 |
from .connection_activated_data_domain import (
|
| 317 |
ConnectionActivatedDataDomain as ConnectionActivatedDataDomain,
|
| 318 |
)
|
| 319 |
-
from .connection_activated_data_state import *
|
| 320 |
-
from .connection_activated_data_status import *
|
| 321 |
from .connection_deactivated import ConnectionDeactivated as ConnectionDeactivated
|
| 322 |
from .connection_deactivated_data import (
|
| 323 |
ConnectionDeactivatedData as ConnectionDeactivatedData,
|
| 324 |
)
|
| 325 |
-
from .connection_deactivated_data_connection_type import *
|
| 326 |
from .connection_deactivated_data_domain import (
|
| 327 |
ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain,
|
| 328 |
)
|
| 329 |
-
from .connection_deactivated_data_state import *
|
| 330 |
-
from .connection_deactivated_data_status import *
|
| 331 |
from .connection_deleted import ConnectionDeleted as ConnectionDeleted
|
| 332 |
from .connection_deleted_data import ConnectionDeletedData as ConnectionDeletedData
|
| 333 |
-
from .connection_deleted_data_connection_type import *
|
| 334 |
-
from .connection_deleted_data_state import *
|
| 335 |
from .connection_saml_certificate_renewal_required import (
|
| 336 |
ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired,
|
| 337 |
)
|
|
@@ -341,7 +335,6 @@ from .connection_saml_certificate_renewal_required_data import (
|
|
| 341 |
from .connection_saml_certificate_renewal_required_data_certificate import (
|
| 342 |
ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate,
|
| 343 |
)
|
| 344 |
-
from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import *
|
| 345 |
from .connection_saml_certificate_renewal_required_data_connection import (
|
| 346 |
ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection,
|
| 347 |
)
|
|
@@ -354,7 +347,6 @@ from .connection_saml_certificate_renewed_data import (
|
|
| 354 |
from .connection_saml_certificate_renewed_data_certificate import (
|
| 355 |
ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate,
|
| 356 |
)
|
| 357 |
-
from .connection_saml_certificate_renewed_data_certificate_certificate_type import *
|
| 358 |
from .connection_saml_certificate_renewed_data_connection import (
|
| 359 |
ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection,
|
| 360 |
)
|
|
@@ -415,7 +407,6 @@ from .directory_state import DirectoryState as DirectoryState
|
|
| 415 |
from .directory_type import DirectoryType as DirectoryType
|
| 416 |
from .directory_user import DirectoryUser as DirectoryUser
|
| 417 |
from .directory_user_email import DirectoryUserEmail as DirectoryUserEmail
|
| 418 |
-
from .directory_user_state import *
|
| 419 |
from .directory_user_with_groups_state import (
|
| 420 |
DirectoryUserWithGroupsState as DirectoryUserWithGroupsState,
|
| 421 |
)
|
|
@@ -424,12 +415,8 @@ from .dsync_activated_data import DsyncActivatedData as DsyncActivatedData
|
|
| 424 |
from .dsync_activated_data_domain import (
|
| 425 |
DsyncActivatedDataDomain as DsyncActivatedDataDomain,
|
| 426 |
)
|
| 427 |
-
from .dsync_activated_data_state import *
|
| 428 |
-
from .dsync_activated_data_type import *
|
| 429 |
from .dsync_deleted import DsyncDeleted as DsyncDeleted
|
| 430 |
from .dsync_deleted_data import DsyncDeletedData as DsyncDeletedData
|
| 431 |
-
from .dsync_deleted_data_state import *
|
| 432 |
-
from .dsync_deleted_data_type import *
|
| 433 |
from .dsync_group_created import DsyncGroupCreated as DsyncGroupCreated
|
| 434 |
from .dsync_group_deleted import DsyncGroupDeleted as DsyncGroupDeleted
|
| 435 |
from .dsync_group_updated import DsyncGroupUpdated as DsyncGroupUpdated
|
|
@@ -453,7 +440,6 @@ from .dsync_user_updated_data import DsyncUserUpdatedData as DsyncUserUpdatedDat
|
|
| 453 |
from .dsync_user_updated_data_email import (
|
| 454 |
DsyncUserUpdatedDataEmail as DsyncUserUpdatedDataEmail,
|
| 455 |
)
|
| 456 |
-
from .dsync_user_updated_data_state import *
|
| 457 |
from .email_verification_created import (
|
| 458 |
EmailVerificationCreated as EmailVerificationCreated,
|
| 459 |
)
|
|
@@ -463,7 +449,6 @@ from .email_verification_created_data import (
|
|
| 463 |
from .error_response import ErrorResponse as ErrorResponse
|
| 464 |
from .event_context import EventContext as EventContext
|
| 465 |
from .event_context_actor import EventContextActor as EventContextActor
|
| 466 |
-
from .event_context_actor_source import *
|
| 467 |
from .event_context_google_analytics_session import (
|
| 468 |
EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession,
|
| 469 |
)
|
|
@@ -475,7 +460,6 @@ from .flag_created_context import FlagCreatedContext as FlagCreatedContext
|
|
| 475 |
from .flag_created_context_actor import (
|
| 476 |
FlagCreatedContextActor as FlagCreatedContextActor,
|
| 477 |
)
|
| 478 |
-
from .flag_created_context_actor_source import *
|
| 479 |
from .flag_created_data import FlagCreatedData as FlagCreatedData
|
| 480 |
from .flag_created_data_owner import FlagCreatedDataOwner as FlagCreatedDataOwner
|
| 481 |
from .flag_deleted import FlagDeleted as FlagDeleted
|
|
@@ -483,17 +467,14 @@ from .flag_deleted_context import FlagDeletedContext as FlagDeletedContext
|
|
| 483 |
from .flag_deleted_context_actor import (
|
| 484 |
FlagDeletedContextActor as FlagDeletedContextActor,
|
| 485 |
)
|
| 486 |
-
from .flag_deleted_context_actor_source import *
|
| 487 |
from .flag_deleted_data import FlagDeletedData as FlagDeletedData
|
| 488 |
from .flag_deleted_data_owner import FlagDeletedDataOwner as FlagDeletedDataOwner
|
| 489 |
from .flag_owner import FlagOwner as FlagOwner
|
| 490 |
from .flag_rule_updated import FlagRuleUpdated as FlagRuleUpdated
|
| 491 |
from .flag_rule_updated_context import FlagRuleUpdatedContext as FlagRuleUpdatedContext
|
| 492 |
-
from .flag_rule_updated_context_access_type import *
|
| 493 |
from .flag_rule_updated_context_actor import (
|
| 494 |
FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor,
|
| 495 |
)
|
| 496 |
-
from .flag_rule_updated_context_actor_source import *
|
| 497 |
from .flag_rule_updated_context_configured_target import (
|
| 498 |
FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget,
|
| 499 |
)
|
|
@@ -509,7 +490,6 @@ from .flag_rule_updated_context_previous_attribute import (
|
|
| 509 |
from .flag_rule_updated_context_previous_attribute_context import (
|
| 510 |
FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext,
|
| 511 |
)
|
| 512 |
-
from .flag_rule_updated_context_previous_attribute_context_access_type import *
|
| 513 |
from .flag_rule_updated_context_previous_attribute_context_configured_target import (
|
| 514 |
FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget,
|
| 515 |
)
|
|
@@ -531,7 +511,6 @@ from .flag_updated_context import FlagUpdatedContext as FlagUpdatedContext
|
|
| 531 |
from .flag_updated_context_actor import (
|
| 532 |
FlagUpdatedContextActor as FlagUpdatedContextActor,
|
| 533 |
)
|
| 534 |
-
from .flag_updated_context_actor_source import *
|
| 535 |
from .flag_updated_context_previous_attribute import (
|
| 536 |
FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute,
|
| 537 |
)
|
|
@@ -551,16 +530,12 @@ from .group_member_removed_data import GroupMemberRemovedData as GroupMemberRemo
|
|
| 551 |
from .group_updated import GroupUpdated as GroupUpdated
|
| 552 |
from .invitation_accepted import InvitationAccepted as InvitationAccepted
|
| 553 |
from .invitation_accepted_data import InvitationAcceptedData as InvitationAcceptedData
|
| 554 |
-
from .invitation_accepted_data_state import *
|
| 555 |
from .invitation_created import InvitationCreated as InvitationCreated
|
| 556 |
from .invitation_created_data import InvitationCreatedData as InvitationCreatedData
|
| 557 |
-
from .invitation_created_data_state import *
|
| 558 |
from .invitation_resent import InvitationResent as InvitationResent
|
| 559 |
from .invitation_resent_data import InvitationResentData as InvitationResentData
|
| 560 |
-
from .invitation_resent_data_state import *
|
| 561 |
from .invitation_revoked import InvitationRevoked as InvitationRevoked
|
| 562 |
from .invitation_revoked_data import InvitationRevokedData as InvitationRevokedData
|
| 563 |
-
from .invitation_revoked_data_state import *
|
| 564 |
from .invitation_state import InvitationState as InvitationState
|
| 565 |
from .list_metadata import ListMetadata as ListMetadata
|
| 566 |
from .magic_auth_created import MagicAuthCreated as MagicAuthCreated
|
|
@@ -572,8 +547,6 @@ from .organization_created_data import (
|
|
| 572 |
from .organization_created_data_domain import (
|
| 573 |
OrganizationCreatedDataDomain as OrganizationCreatedDataDomain,
|
| 574 |
)
|
| 575 |
-
from .organization_created_data_domain_state import *
|
| 576 |
-
from .organization_created_data_domain_verification_strategy import *
|
| 577 |
from .organization_deleted import OrganizationDeleted as OrganizationDeleted
|
| 578 |
from .organization_deleted_data import (
|
| 579 |
OrganizationDeletedData as OrganizationDeletedData,
|
|
@@ -581,8 +554,6 @@ from .organization_deleted_data import (
|
|
| 581 |
from .organization_deleted_data_domain import (
|
| 582 |
OrganizationDeletedDataDomain as OrganizationDeletedDataDomain,
|
| 583 |
)
|
| 584 |
-
from .organization_deleted_data_domain_state import *
|
| 585 |
-
from .organization_deleted_data_domain_verification_strategy import *
|
| 586 |
from .organization_domain import OrganizationDomain as OrganizationDomain
|
| 587 |
from .organization_domain_created import (
|
| 588 |
OrganizationDomainCreated as OrganizationDomainCreated,
|
|
@@ -590,8 +561,6 @@ from .organization_domain_created import (
|
|
| 590 |
from .organization_domain_created_data import (
|
| 591 |
OrganizationDomainCreatedData as OrganizationDomainCreatedData,
|
| 592 |
)
|
| 593 |
-
from .organization_domain_created_data_state import *
|
| 594 |
-
from .organization_domain_created_data_verification_strategy import *
|
| 595 |
from .organization_domain_data_state import (
|
| 596 |
OrganizationDomainDataState as OrganizationDomainDataState,
|
| 597 |
)
|
|
@@ -601,8 +570,6 @@ from .organization_domain_deleted import (
|
|
| 601 |
from .organization_domain_deleted_data import (
|
| 602 |
OrganizationDomainDeletedData as OrganizationDomainDeletedData,
|
| 603 |
)
|
| 604 |
-
from .organization_domain_deleted_data_state import *
|
| 605 |
-
from .organization_domain_deleted_data_verification_strategy import *
|
| 606 |
from .organization_domain_state import (
|
| 607 |
OrganizationDomainState as OrganizationDomainState,
|
| 608 |
)
|
|
@@ -612,8 +579,6 @@ from .organization_domain_updated import (
|
|
| 612 |
from .organization_domain_updated_data import (
|
| 613 |
OrganizationDomainUpdatedData as OrganizationDomainUpdatedData,
|
| 614 |
)
|
| 615 |
-
from .organization_domain_updated_data_state import *
|
| 616 |
-
from .organization_domain_updated_data_verification_strategy import *
|
| 617 |
from .organization_domain_verification_failed import (
|
| 618 |
OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed,
|
| 619 |
)
|
|
@@ -623,9 +588,6 @@ from .organization_domain_verification_failed_data import (
|
|
| 623 |
from .organization_domain_verification_failed_data_organization_domain import (
|
| 624 |
OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain,
|
| 625 |
)
|
| 626 |
-
from .organization_domain_verification_failed_data_organization_domain_state import *
|
| 627 |
-
from .organization_domain_verification_failed_data_organization_domain_verification_strategy import *
|
| 628 |
-
from .organization_domain_verification_failed_data_reason import *
|
| 629 |
from .organization_domain_verification_strategy import (
|
| 630 |
OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy,
|
| 631 |
)
|
|
@@ -635,22 +597,18 @@ from .organization_domain_verified import (
|
|
| 635 |
from .organization_domain_verified_data import (
|
| 636 |
OrganizationDomainVerifiedData as OrganizationDomainVerifiedData,
|
| 637 |
)
|
| 638 |
-
from .organization_domain_verified_data_state import *
|
| 639 |
-
from .organization_domain_verified_data_verification_strategy import *
|
| 640 |
from .organization_membership_created import (
|
| 641 |
OrganizationMembershipCreated as OrganizationMembershipCreated,
|
| 642 |
)
|
| 643 |
from .organization_membership_created_data import (
|
| 644 |
OrganizationMembershipCreatedData as OrganizationMembershipCreatedData,
|
| 645 |
)
|
| 646 |
-
from .organization_membership_created_data_status import *
|
| 647 |
from .organization_membership_deleted import (
|
| 648 |
OrganizationMembershipDeleted as OrganizationMembershipDeleted,
|
| 649 |
)
|
| 650 |
from .organization_membership_deleted_data import (
|
| 651 |
OrganizationMembershipDeletedData as OrganizationMembershipDeletedData,
|
| 652 |
)
|
| 653 |
-
from .organization_membership_deleted_data_status import *
|
| 654 |
from .organization_membership_status import (
|
| 655 |
OrganizationMembershipStatus as OrganizationMembershipStatus,
|
| 656 |
)
|
|
@@ -660,7 +618,6 @@ from .organization_membership_updated import (
|
|
| 660 |
from .organization_membership_updated_data import (
|
| 661 |
OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData,
|
| 662 |
)
|
| 663 |
-
from .organization_membership_updated_data_status import *
|
| 664 |
from .organization_role_created import (
|
| 665 |
OrganizationRoleCreated as OrganizationRoleCreated,
|
| 666 |
)
|
|
@@ -686,8 +643,6 @@ from .organization_updated_data import (
|
|
| 686 |
from .organization_updated_data_domain import (
|
| 687 |
OrganizationUpdatedDataDomain as OrganizationUpdatedDataDomain,
|
| 688 |
)
|
| 689 |
-
from .organization_updated_data_domain_state import *
|
| 690 |
-
from .organization_updated_data_domain_verification_strategy import *
|
| 691 |
from .pagination_order import PaginationOrder as PaginationOrder
|
| 692 |
from .password_reset_created import PasswordResetCreated as PasswordResetCreated
|
| 693 |
from .password_reset_created_data import (
|
|
@@ -704,7 +659,6 @@ from .permission_deleted_data import PermissionDeletedData as PermissionDeletedD
|
|
| 704 |
from .permission_updated import PermissionUpdated as PermissionUpdated
|
| 705 |
from .permission_updated_data import PermissionUpdatedData as PermissionUpdatedData
|
| 706 |
from .pipe_connected_account import PipeConnectedAccount as PipeConnectedAccount
|
| 707 |
-
from .pipe_connected_account_state import *
|
| 708 |
from .pipes_connected_account_connected import (
|
| 709 |
PipesConnectedAccountConnected as PipesConnectedAccountConnected,
|
| 710 |
)
|
|
@@ -752,18 +706,14 @@ from .role_updated import RoleUpdated as RoleUpdated
|
|
| 752 |
from .role_updated_data import RoleUpdatedData as RoleUpdatedData
|
| 753 |
from .session_created import SessionCreated as SessionCreated
|
| 754 |
from .session_created_data import SessionCreatedData as SessionCreatedData
|
| 755 |
-
from .session_created_data_auth_method import *
|
| 756 |
from .session_created_data_impersonator import (
|
| 757 |
SessionCreatedDataImpersonator as SessionCreatedDataImpersonator,
|
| 758 |
)
|
| 759 |
-
from .session_created_data_status import *
|
| 760 |
from .session_revoked import SessionRevoked as SessionRevoked
|
| 761 |
from .session_revoked_data import SessionRevokedData as SessionRevokedData
|
| 762 |
-
from .session_revoked_data_auth_method import *
|
| 763 |
from .session_revoked_data_impersonator import (
|
| 764 |
SessionRevokedDataImpersonator as SessionRevokedDataImpersonator,
|
| 765 |
)
|
| 766 |
-
from .session_revoked_data_status import *
|
| 767 |
from .slim_role import SlimRole as SlimRole
|
| 768 |
from .update_custom_provider_definition_authenticate_via import (
|
| 769 |
UpdateCustomProviderDefinitionAuthenticateVia as UpdateCustomProviderDefinitionAuthenticateVia,
|
|
@@ -816,7 +766,6 @@ from .vault_byok_key_deleted import VaultByokKeyDeleted as VaultByokKeyDeleted
|
|
| 816 |
from .vault_byok_key_deleted_data import (
|
| 817 |
VaultByokKeyDeletedData as VaultByokKeyDeletedData,
|
| 818 |
)
|
| 819 |
-
from .vault_byok_key_provider import *
|
| 820 |
from .vault_byok_key_verification_completed import (
|
| 821 |
VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted,
|
| 822 |
)
|
|
@@ -825,39 +774,28 @@ from .vault_byok_key_verification_completed_data import (
|
|
| 825 |
)
|
| 826 |
from .vault_data_created import VaultDataCreated as VaultDataCreated
|
| 827 |
from .vault_data_created_data import VaultDataCreatedData as VaultDataCreatedData
|
| 828 |
-
from .vault_data_created_data_actor_source import *
|
| 829 |
from .vault_data_deleted import VaultDataDeleted as VaultDataDeleted
|
| 830 |
from .vault_data_deleted_data import VaultDataDeletedData as VaultDataDeletedData
|
| 831 |
-
from .vault_data_deleted_data_actor_source import *
|
| 832 |
from .vault_data_read import VaultDataRead as VaultDataRead
|
| 833 |
from .vault_data_read_data import VaultDataReadData as VaultDataReadData
|
| 834 |
-
from .vault_data_read_data_actor_source import *
|
| 835 |
from .vault_data_updated import VaultDataUpdated as VaultDataUpdated
|
| 836 |
from .vault_data_updated_data import VaultDataUpdatedData as VaultDataUpdatedData
|
| 837 |
-
from .vault_data_updated_data_actor_source import *
|
| 838 |
from .vault_dek_decrypted import VaultDekDecrypted as VaultDekDecrypted
|
| 839 |
from .vault_dek_decrypted_data import VaultDekDecryptedData as VaultDekDecryptedData
|
| 840 |
-
from .vault_dek_decrypted_data_actor_source import *
|
| 841 |
from .vault_dek_read import VaultDekRead as VaultDekRead
|
| 842 |
from .vault_dek_read_data import VaultDekReadData as VaultDekReadData
|
| 843 |
-
from .vault_dek_read_data_actor_source import *
|
| 844 |
from .vault_kek_created import VaultKekCreated as VaultKekCreated
|
| 845 |
from .vault_kek_created_data import VaultKekCreatedData as VaultKekCreatedData
|
| 846 |
-
from .vault_kek_created_data_actor_source import *
|
| 847 |
from .vault_kek_deleted import VaultKekDeleted as VaultKekDeleted
|
| 848 |
from .vault_kek_deleted_data import VaultKekDeletedData as VaultKekDeletedData
|
| 849 |
-
from .vault_kek_deleted_data_actor_source import *
|
| 850 |
from .vault_metadata_read import VaultMetadataRead as VaultMetadataRead
|
| 851 |
from .vault_metadata_read_data import VaultMetadataReadData as VaultMetadataReadData
|
| 852 |
-
from .vault_metadata_read_data_actor_source import *
|
| 853 |
from .vault_names_listed import VaultNamesListed as VaultNamesListed
|
| 854 |
from .vault_names_listed_data import VaultNamesListedData as VaultNamesListedData
|
| 855 |
-
from .vault_names_listed_data_actor_source import *
|
| 856 |
from .waitlist_user import WaitlistUser as WaitlistUser
|
| 857 |
from .waitlist_user_approved import WaitlistUserApproved as WaitlistUserApproved
|
| 858 |
from .waitlist_user_created import WaitlistUserCreated as WaitlistUserCreated
|
| 859 |
from .waitlist_user_denied import WaitlistUserDenied as WaitlistUserDenied
|
| 860 |
-
from .waitlist_user_state import *
|
| 861 |
from .webhook_endpoint_status import WebhookEndpointStatus as WebhookEndpointStatus
|
| 862 |
from .widget_session_token_scopes import (
|
| 863 |
WidgetSessionTokenScopes as WidgetSessionTokenScopes,
|
|
|
|
| 44 |
from .agent_registration_created_data_agent_identity import (
|
| 45 |
AgentRegistrationCreatedDataAgentIdentity as AgentRegistrationCreatedDataAgentIdentity,
|
| 46 |
)
|
|
|
|
|
|
|
|
|
|
| 47 |
from .agent_registration_credential_issued import (
|
| 48 |
AgentRegistrationCredentialIssued as AgentRegistrationCredentialIssued,
|
| 49 |
)
|
|
|
|
| 72 |
from .agent_registration_organization_switched_data import (
|
| 73 |
AgentRegistrationOrganizationSwitchedData as AgentRegistrationOrganizationSwitchedData,
|
| 74 |
)
|
| 75 |
+
from .agent_registration_refreshed import (
|
| 76 |
+
AgentRegistrationRefreshed as AgentRegistrationRefreshed,
|
| 77 |
+
)
|
| 78 |
+
from .agent_registration_refreshed_data import (
|
| 79 |
+
AgentRegistrationRefreshedData as AgentRegistrationRefreshedData,
|
| 80 |
+
)
|
| 81 |
from .agent_registration_revoked import (
|
| 82 |
AgentRegistrationRevoked as AgentRegistrationRevoked,
|
| 83 |
)
|
|
|
|
| 240 |
from .authentication_radar_risk_detected_data import (
|
| 241 |
AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData,
|
| 242 |
)
|
|
|
|
| 243 |
from .authentication_reauthentication_succeeded import (
|
| 244 |
AuthenticationReauthenticationSucceeded as AuthenticationReauthenticationSucceeded,
|
| 245 |
)
|
|
|
|
| 314 |
from .connection_activated_data import (
|
| 315 |
ConnectionActivatedData as ConnectionActivatedData,
|
| 316 |
)
|
|
|
|
| 317 |
from .connection_activated_data_domain import (
|
| 318 |
ConnectionActivatedDataDomain as ConnectionActivatedDataDomain,
|
| 319 |
)
|
|
|
|
|
|
|
| 320 |
from .connection_deactivated import ConnectionDeactivated as ConnectionDeactivated
|
| 321 |
from .connection_deactivated_data import (
|
| 322 |
ConnectionDeactivatedData as ConnectionDeactivatedData,
|
| 323 |
)
|
|
|
|
| 324 |
from .connection_deactivated_data_domain import (
|
| 325 |
ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain,
|
| 326 |
)
|
|
|
|
|
|
|
| 327 |
from .connection_deleted import ConnectionDeleted as ConnectionDeleted
|
| 328 |
from .connection_deleted_data import ConnectionDeletedData as ConnectionDeletedData
|
|
|
|
|
|
|
| 329 |
from .connection_saml_certificate_renewal_required import (
|
| 330 |
ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired,
|
| 331 |
)
|
|
|
|
| 335 |
from .connection_saml_certificate_renewal_required_data_certificate import (
|
| 336 |
ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate,
|
| 337 |
)
|
|
|
|
| 338 |
from .connection_saml_certificate_renewal_required_data_connection import (
|
| 339 |
ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection,
|
| 340 |
)
|
|
|
|
| 347 |
from .connection_saml_certificate_renewed_data_certificate import (
|
| 348 |
ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate,
|
| 349 |
)
|
|
|
|
| 350 |
from .connection_saml_certificate_renewed_data_connection import (
|
| 351 |
ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection,
|
| 352 |
)
|
|
|
|
| 407 |
from .directory_type import DirectoryType as DirectoryType
|
| 408 |
from .directory_user import DirectoryUser as DirectoryUser
|
| 409 |
from .directory_user_email import DirectoryUserEmail as DirectoryUserEmail
|
|
|
|
| 410 |
from .directory_user_with_groups_state import (
|
| 411 |
DirectoryUserWithGroupsState as DirectoryUserWithGroupsState,
|
| 412 |
)
|
|
|
|
| 415 |
from .dsync_activated_data_domain import (
|
| 416 |
DsyncActivatedDataDomain as DsyncActivatedDataDomain,
|
| 417 |
)
|
|
|
|
|
|
|
| 418 |
from .dsync_deleted import DsyncDeleted as DsyncDeleted
|
| 419 |
from .dsync_deleted_data import DsyncDeletedData as DsyncDeletedData
|
|
|
|
|
|
|
| 420 |
from .dsync_group_created import DsyncGroupCreated as DsyncGroupCreated
|
| 421 |
from .dsync_group_deleted import DsyncGroupDeleted as DsyncGroupDeleted
|
| 422 |
from .dsync_group_updated import DsyncGroupUpdated as DsyncGroupUpdated
|
|
|
|
| 440 |
from .dsync_user_updated_data_email import (
|
| 441 |
DsyncUserUpdatedDataEmail as DsyncUserUpdatedDataEmail,
|
| 442 |
)
|
|
|
|
| 443 |
from .email_verification_created import (
|
| 444 |
EmailVerificationCreated as EmailVerificationCreated,
|
| 445 |
)
|
|
|
|
| 449 |
from .error_response import ErrorResponse as ErrorResponse
|
| 450 |
from .event_context import EventContext as EventContext
|
| 451 |
from .event_context_actor import EventContextActor as EventContextActor
|
|
|
|
| 452 |
from .event_context_google_analytics_session import (
|
| 453 |
EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession,
|
| 454 |
)
|
|
|
|
| 460 |
from .flag_created_context_actor import (
|
| 461 |
FlagCreatedContextActor as FlagCreatedContextActor,
|
| 462 |
)
|
|
|
|
| 463 |
from .flag_created_data import FlagCreatedData as FlagCreatedData
|
| 464 |
from .flag_created_data_owner import FlagCreatedDataOwner as FlagCreatedDataOwner
|
| 465 |
from .flag_deleted import FlagDeleted as FlagDeleted
|
|
|
|
| 467 |
from .flag_deleted_context_actor import (
|
| 468 |
FlagDeletedContextActor as FlagDeletedContextActor,
|
| 469 |
)
|
|
|
|
| 470 |
from .flag_deleted_data import FlagDeletedData as FlagDeletedData
|
| 471 |
from .flag_deleted_data_owner import FlagDeletedDataOwner as FlagDeletedDataOwner
|
| 472 |
from .flag_owner import FlagOwner as FlagOwner
|
| 473 |
from .flag_rule_updated import FlagRuleUpdated as FlagRuleUpdated
|
| 474 |
from .flag_rule_updated_context import FlagRuleUpdatedContext as FlagRuleUpdatedContext
|
|
|
|
| 475 |
from .flag_rule_updated_context_actor import (
|
| 476 |
FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor,
|
| 477 |
)
|
|
|
|
| 478 |
from .flag_rule_updated_context_configured_target import (
|
| 479 |
FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget,
|
| 480 |
)
|
|
|
|
| 490 |
from .flag_rule_updated_context_previous_attribute_context import (
|
| 491 |
FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext,
|
| 492 |
)
|
|
|
|
| 493 |
from .flag_rule_updated_context_previous_attribute_context_configured_target import (
|
| 494 |
FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget,
|
| 495 |
)
|
|
|
|
| 511 |
from .flag_updated_context_actor import (
|
| 512 |
FlagUpdatedContextActor as FlagUpdatedContextActor,
|
| 513 |
)
|
|
|
|
| 514 |
from .flag_updated_context_previous_attribute import (
|
| 515 |
FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute,
|
| 516 |
)
|
|
|
|
| 530 |
from .group_updated import GroupUpdated as GroupUpdated
|
| 531 |
from .invitation_accepted import InvitationAccepted as InvitationAccepted
|
| 532 |
from .invitation_accepted_data import InvitationAcceptedData as InvitationAcceptedData
|
|
|
|
| 533 |
from .invitation_created import InvitationCreated as InvitationCreated
|
| 534 |
from .invitation_created_data import InvitationCreatedData as InvitationCreatedData
|
|
|
|
| 535 |
from .invitation_resent import InvitationResent as InvitationResent
|
| 536 |
from .invitation_resent_data import InvitationResentData as InvitationResentData
|
|
|
|
| 537 |
from .invitation_revoked import InvitationRevoked as InvitationRevoked
|
| 538 |
from .invitation_revoked_data import InvitationRevokedData as InvitationRevokedData
|
|
|
|
| 539 |
from .invitation_state import InvitationState as InvitationState
|
| 540 |
from .list_metadata import ListMetadata as ListMetadata
|
| 541 |
from .magic_auth_created import MagicAuthCreated as MagicAuthCreated
|
|
|
|
| 547 |
from .organization_created_data_domain import (
|
| 548 |
OrganizationCreatedDataDomain as OrganizationCreatedDataDomain,
|
| 549 |
)
|
|
|
|
|
|
|
| 550 |
from .organization_deleted import OrganizationDeleted as OrganizationDeleted
|
| 551 |
from .organization_deleted_data import (
|
| 552 |
OrganizationDeletedData as OrganizationDeletedData,
|
|
|
|
| 554 |
from .organization_deleted_data_domain import (
|
| 555 |
OrganizationDeletedDataDomain as OrganizationDeletedDataDomain,
|
| 556 |
)
|
|
|
|
|
|
|
| 557 |
from .organization_domain import OrganizationDomain as OrganizationDomain
|
| 558 |
from .organization_domain_created import (
|
| 559 |
OrganizationDomainCreated as OrganizationDomainCreated,
|
|
|
|
| 561 |
from .organization_domain_created_data import (
|
| 562 |
OrganizationDomainCreatedData as OrganizationDomainCreatedData,
|
| 563 |
)
|
|
|
|
|
|
|
| 564 |
from .organization_domain_data_state import (
|
| 565 |
OrganizationDomainDataState as OrganizationDomainDataState,
|
| 566 |
)
|
|
|
|
| 570 |
from .organization_domain_deleted_data import (
|
| 571 |
OrganizationDomainDeletedData as OrganizationDomainDeletedData,
|
| 572 |
)
|
|
|
|
|
|
|
| 573 |
from .organization_domain_state import (
|
| 574 |
OrganizationDomainState as OrganizationDomainState,
|
| 575 |
)
|
|
|
|
| 579 |
from .organization_domain_updated_data import (
|
| 580 |
OrganizationDomainUpdatedData as OrganizationDomainUpdatedData,
|
| 581 |
)
|
|
|
|
|
|
|
| 582 |
from .organization_domain_verification_failed import (
|
| 583 |
OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed,
|
| 584 |
)
|
|
|
|
| 588 |
from .organization_domain_verification_failed_data_organization_domain import (
|
| 589 |
OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain,
|
| 590 |
)
|
|
|
|
|
|
|
|
|
|
| 591 |
from .organization_domain_verification_strategy import (
|
| 592 |
OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy,
|
| 593 |
)
|
|
|
|
| 597 |
from .organization_domain_verified_data import (
|
| 598 |
OrganizationDomainVerifiedData as OrganizationDomainVerifiedData,
|
| 599 |
)
|
|
|
|
|
|
|
| 600 |
from .organization_membership_created import (
|
| 601 |
OrganizationMembershipCreated as OrganizationMembershipCreated,
|
| 602 |
)
|
| 603 |
from .organization_membership_created_data import (
|
| 604 |
OrganizationMembershipCreatedData as OrganizationMembershipCreatedData,
|
| 605 |
)
|
|
|
|
| 606 |
from .organization_membership_deleted import (
|
| 607 |
OrganizationMembershipDeleted as OrganizationMembershipDeleted,
|
| 608 |
)
|
| 609 |
from .organization_membership_deleted_data import (
|
| 610 |
OrganizationMembershipDeletedData as OrganizationMembershipDeletedData,
|
| 611 |
)
|
|
|
|
| 612 |
from .organization_membership_status import (
|
| 613 |
OrganizationMembershipStatus as OrganizationMembershipStatus,
|
| 614 |
)
|
|
|
|
| 618 |
from .organization_membership_updated_data import (
|
| 619 |
OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData,
|
| 620 |
)
|
|
|
|
| 621 |
from .organization_role_created import (
|
| 622 |
OrganizationRoleCreated as OrganizationRoleCreated,
|
| 623 |
)
|
|
|
|
| 643 |
from .organization_updated_data_domain import (
|
| 644 |
OrganizationUpdatedDataDomain as OrganizationUpdatedDataDomain,
|
| 645 |
)
|
|
|
|
|
|
|
| 646 |
from .pagination_order import PaginationOrder as PaginationOrder
|
| 647 |
from .password_reset_created import PasswordResetCreated as PasswordResetCreated
|
| 648 |
from .password_reset_created_data import (
|
|
|
|
| 659 |
from .permission_updated import PermissionUpdated as PermissionUpdated
|
| 660 |
from .permission_updated_data import PermissionUpdatedData as PermissionUpdatedData
|
| 661 |
from .pipe_connected_account import PipeConnectedAccount as PipeConnectedAccount
|
|
|
|
| 662 |
from .pipes_connected_account_connected import (
|
| 663 |
PipesConnectedAccountConnected as PipesConnectedAccountConnected,
|
| 664 |
)
|
|
|
|
| 706 |
from .role_updated_data import RoleUpdatedData as RoleUpdatedData
|
| 707 |
from .session_created import SessionCreated as SessionCreated
|
| 708 |
from .session_created_data import SessionCreatedData as SessionCreatedData
|
|
|
|
| 709 |
from .session_created_data_impersonator import (
|
| 710 |
SessionCreatedDataImpersonator as SessionCreatedDataImpersonator,
|
| 711 |
)
|
|
|
|
| 712 |
from .session_revoked import SessionRevoked as SessionRevoked
|
| 713 |
from .session_revoked_data import SessionRevokedData as SessionRevokedData
|
|
|
|
| 714 |
from .session_revoked_data_impersonator import (
|
| 715 |
SessionRevokedDataImpersonator as SessionRevokedDataImpersonator,
|
| 716 |
)
|
|
|
|
| 717 |
from .slim_role import SlimRole as SlimRole
|
| 718 |
from .update_custom_provider_definition_authenticate_via import (
|
| 719 |
UpdateCustomProviderDefinitionAuthenticateVia as UpdateCustomProviderDefinitionAuthenticateVia,
|
|
|
|
| 766 |
from .vault_byok_key_deleted_data import (
|
| 767 |
VaultByokKeyDeletedData as VaultByokKeyDeletedData,
|
| 768 |
)
|
|
|
|
| 769 |
from .vault_byok_key_verification_completed import (
|
| 770 |
VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted,
|
| 771 |
)
|
|
|
|
| 774 |
)
|
| 775 |
from .vault_data_created import VaultDataCreated as VaultDataCreated
|
| 776 |
from .vault_data_created_data import VaultDataCreatedData as VaultDataCreatedData
|
|
|
|
| 777 |
from .vault_data_deleted import VaultDataDeleted as VaultDataDeleted
|
| 778 |
from .vault_data_deleted_data import VaultDataDeletedData as VaultDataDeletedData
|
|
|
|
| 779 |
from .vault_data_read import VaultDataRead as VaultDataRead
|
| 780 |
from .vault_data_read_data import VaultDataReadData as VaultDataReadData
|
|
|
|
| 781 |
from .vault_data_updated import VaultDataUpdated as VaultDataUpdated
|
| 782 |
from .vault_data_updated_data import VaultDataUpdatedData as VaultDataUpdatedData
|
|
|
|
| 783 |
from .vault_dek_decrypted import VaultDekDecrypted as VaultDekDecrypted
|
| 784 |
from .vault_dek_decrypted_data import VaultDekDecryptedData as VaultDekDecryptedData
|
|
|
|
| 785 |
from .vault_dek_read import VaultDekRead as VaultDekRead
|
| 786 |
from .vault_dek_read_data import VaultDekReadData as VaultDekReadData
|
|
|
|
| 787 |
from .vault_kek_created import VaultKekCreated as VaultKekCreated
|
| 788 |
from .vault_kek_created_data import VaultKekCreatedData as VaultKekCreatedData
|
|
|
|
| 789 |
from .vault_kek_deleted import VaultKekDeleted as VaultKekDeleted
|
| 790 |
from .vault_kek_deleted_data import VaultKekDeletedData as VaultKekDeletedData
|
|
|
|
| 791 |
from .vault_metadata_read import VaultMetadataRead as VaultMetadataRead
|
| 792 |
from .vault_metadata_read_data import VaultMetadataReadData as VaultMetadataReadData
|
|
|
|
| 793 |
from .vault_names_listed import VaultNamesListed as VaultNamesListed
|
| 794 |
from .vault_names_listed_data import VaultNamesListedData as VaultNamesListedData
|
|
|
|
| 795 |
from .waitlist_user import WaitlistUser as WaitlistUser
|
| 796 |
from .waitlist_user_approved import WaitlistUserApproved as WaitlistUserApproved
|
| 797 |
from .waitlist_user_created import WaitlistUserCreated as WaitlistUserCreated
|
| 798 |
from .waitlist_user_denied import WaitlistUserDenied as WaitlistUserDenied
|
|
|
|
| 799 |
from .webhook_endpoint_status import WebhookEndpointStatus as WebhookEndpointStatus
|
| 800 |
from .widget_session_token_scopes import (
|
| 801 |
WidgetSessionTokenScopes as WidgetSessionTokenScopes,
|
python/src/workos/common/models/access_token_agent_registration_credential_issued_data_detail.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,13 +16,13 @@ class AccessTokenAgentRegistrationCredentialIssuedDataDetail:
|
|
| 15 |
"""The kind of credential issued."""
|
| 16 |
jti: str
|
| 17 |
"""The JWT ID of the issued access token."""
|
| 18 |
-
expires_at:
|
| 19 |
"""The timestamp when the access token expires."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
def from_dict(
|
| 23 |
-
cls, data:
|
| 24 |
-
) ->
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -34,9 +35,9 @@ class AccessTokenAgentRegistrationCredentialIssuedDataDetail:
|
|
| 34 |
"AccessTokenAgentRegistrationCredentialIssuedDataDetail", e
|
| 35 |
)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["kind"] = self.kind
|
| 41 |
result["jti"] = self.jti
|
| 42 |
result["expires_at"] = self.expires_at
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The kind of credential issued."""
|
| 17 |
jti: str
|
| 18 |
"""The JWT ID of the issued access token."""
|
| 19 |
+
expires_at: str | Literal["null"] | None
|
| 20 |
"""The timestamp when the access token expires."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
def from_dict(
|
| 24 |
+
cls, data: dict[str, Any]
|
| 25 |
+
) -> AccessTokenAgentRegistrationCredentialIssuedDataDetail:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 35 |
"AccessTokenAgentRegistrationCredentialIssuedDataDetail", e
|
| 36 |
)
|
| 37 |
|
| 38 |
+
def to_dict(self) -> dict[str, Any]:
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
+
result: dict[str, Any] = {}
|
| 41 |
result["kind"] = self.kind
|
| 42 |
result["jti"] = self.jti
|
| 43 |
result["expires_at"] = self.expires_at
|
python/src/workos/common/models/action_authentication_denied.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .action_authentication_denied_data import ActionAuthenticationDeniedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class ActionAuthenticationDenied:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["action.authentication.denied"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class ActionAuthenticationDenied:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "action.authentication.denied"),
|
| 39 |
data=ActionAuthenticationDeniedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("ActionAuthenticationDenied", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .action_authentication_denied_data import ActionAuthenticationDeniedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["action.authentication.denied"]
|
| 24 |
+
data: ActionAuthenticationDeniedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ActionAuthenticationDenied:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "action.authentication.denied"),
|
| 38 |
data=ActionAuthenticationDeniedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ActionAuthenticationDenied", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/action_authentication_denied_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -21,17 +22,17 @@ class ActionAuthenticationDeniedData:
|
|
| 21 |
"""The verdict of the action."""
|
| 22 |
user_id: str
|
| 23 |
"""The ID of the user."""
|
| 24 |
-
organization_id:
|
| 25 |
"""The ID of the organization."""
|
| 26 |
email: str
|
| 27 |
"""The email address of the user."""
|
| 28 |
-
ip_address:
|
| 29 |
"""The IP address of the request."""
|
| 30 |
-
user_agent:
|
| 31 |
"""The user agent of the request."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -48,9 +49,9 @@ class ActionAuthenticationDeniedData:
|
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("ActionAuthenticationDeniedData", e)
|
| 50 |
|
| 51 |
-
def to_dict(self) ->
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
-
result:
|
| 54 |
result["action_endpoint_id"] = self.action_endpoint_id
|
| 55 |
result["action_execution_id"] = self.action_execution_id
|
| 56 |
result["type"] = self.type
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 22 |
"""The verdict of the action."""
|
| 23 |
user_id: str
|
| 24 |
"""The ID of the user."""
|
| 25 |
+
organization_id: str | None
|
| 26 |
"""The ID of the organization."""
|
| 27 |
email: str
|
| 28 |
"""The email address of the user."""
|
| 29 |
+
ip_address: str | None
|
| 30 |
"""The IP address of the request."""
|
| 31 |
+
user_agent: str | None
|
| 32 |
"""The user agent of the request."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
+
def from_dict(cls, data: dict[str, Any]) -> ActionAuthenticationDeniedData:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("ActionAuthenticationDeniedData", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["action_endpoint_id"] = self.action_endpoint_id
|
| 56 |
result["action_execution_id"] = self.action_execution_id
|
| 57 |
result["type"] = self.type
|
python/src/workos/common/models/action_user_registration_denied.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .action_user_registration_denied_data import ActionUserRegistrationDeniedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class ActionUserRegistrationDenied:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["action.user_registration.denied"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class ActionUserRegistrationDenied:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "action.user_registration.denied"),
|
| 39 |
data=ActionUserRegistrationDeniedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("ActionUserRegistrationDenied", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .action_user_registration_denied_data import ActionUserRegistrationDeniedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["action.user_registration.denied"]
|
| 24 |
+
data: ActionUserRegistrationDeniedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ActionUserRegistrationDenied:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "action.user_registration.denied"),
|
| 38 |
data=ActionUserRegistrationDeniedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ActionUserRegistrationDenied", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/action_user_registration_denied_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,17 +20,17 @@ class ActionUserRegistrationDeniedData:
|
|
| 19 |
"""The type of action that was denied."""
|
| 20 |
verdict: Literal["Deny"]
|
| 21 |
"""The verdict of the action."""
|
| 22 |
-
organization_id:
|
| 23 |
"""The ID of the organization."""
|
| 24 |
email: str
|
| 25 |
"""The email address of the user."""
|
| 26 |
-
ip_address:
|
| 27 |
"""The IP address of the request."""
|
| 28 |
-
user_agent:
|
| 29 |
"""The user agent of the request."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -45,9 +46,9 @@ class ActionUserRegistrationDeniedData:
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("ActionUserRegistrationDeniedData", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["action_endpoint_id"] = self.action_endpoint_id
|
| 52 |
result["action_execution_id"] = self.action_execution_id
|
| 53 |
result["type"] = self.type
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The type of action that was denied."""
|
| 21 |
verdict: Literal["Deny"]
|
| 22 |
"""The verdict of the action."""
|
| 23 |
+
organization_id: str | None
|
| 24 |
"""The ID of the organization."""
|
| 25 |
email: str
|
| 26 |
"""The email address of the user."""
|
| 27 |
+
ip_address: str | None
|
| 28 |
"""The IP address of the request."""
|
| 29 |
+
user_agent: str | None
|
| 30 |
"""The user agent of the request."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> ActionUserRegistrationDeniedData:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ActionUserRegistrationDeniedData", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["action_endpoint_id"] = self.action_endpoint_id
|
| 53 |
result["action_execution_id"] = self.action_execution_id
|
| 54 |
result["type"] = self.type
|
python/src/workos/common/models/actor.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class Actor:
|
|
| 17 |
"""Display name of the actor."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class Actor:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("Actor", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["id"] = self.id
|
| 34 |
result["name"] = self.name
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""Display name of the actor."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> Actor:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("Actor", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["id"] = self.id
|
| 35 |
result["name"] = self.name
|
| 36 |
return result
|
python/src/workos/common/models/add_role_permission.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AddRolePermission:
|
|
| 15 |
"""The slug of the permission to add to the role."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AddRolePermission:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AddRolePermission", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["slug"] = self.slug
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The slug of the permission to add to the role."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AddRolePermission:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AddRolePermission", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["slug"] = self.slug
|
| 32 |
return result
|
python/src/workos/common/models/agent_admin_validate_credential_request_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,9 +15,7 @@ class AgentAdminValidateCredentialRequestType(str, Enum):
|
|
| 16 |
ACCESS_TOKEN = "access_token"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(
|
| 20 |
-
cls, value: object
|
| 21 |
-
) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
ACCESS_TOKEN = "access_token"
|
| 16 |
|
| 17 |
@classmethod
|
|
|
|
|
|
|
| 18 |
+
def _missing_(cls, value: object) -> AgentAdminValidateCredentialRequestType | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/agent_registration_claim_attempt_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_claim_attempt_created_data import (
|
| 13 |
AgentRegistrationClaimAttemptCreatedData,
|
|
@@ -24,14 +23,14 @@ class AgentRegistrationClaimAttemptCreated:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["agent.registration.claim.attempt.created"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class AgentRegistrationClaimAttemptCreated:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "agent.registration.claim.attempt.created"),
|
| 41 |
data=AgentRegistrationClaimAttemptCreatedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AgentRegistrationClaimAttemptCreated", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_claim_attempt_created_data import (
|
| 12 |
AgentRegistrationClaimAttemptCreatedData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["agent.registration.claim.attempt.created"]
|
| 26 |
+
data: AgentRegistrationClaimAttemptCreatedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimAttemptCreated:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "agent.registration.claim.attempt.created"),
|
| 40 |
data=AgentRegistrationClaimAttemptCreatedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AgentRegistrationClaimAttemptCreated", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_claim_attempt_created_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -30,8 +31,8 @@ class AgentRegistrationClaimAttemptCreatedData:
|
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
def from_dict(
|
| 33 |
-
cls, data:
|
| 34 |
-
) ->
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -47,9 +48,9 @@ class AgentRegistrationClaimAttemptCreatedData:
|
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationClaimAttemptCreatedData", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["agent_registration_id"] = self.agent_registration_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
+
cls, data: dict[str, Any]
|
| 35 |
+
) -> AgentRegistrationClaimAttemptCreatedData:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AgentRegistrationClaimAttemptCreatedData", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["agent_registration_id"] = self.agent_registration_id
|
python/src/workos/common/models/agent_registration_claim_completed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_claim_completed_data import AgentRegistrationClaimCompletedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AgentRegistrationClaimCompleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["agent.registration.claim.completed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AgentRegistrationClaimCompleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "agent.registration.claim.completed"),
|
| 39 |
data=AgentRegistrationClaimCompletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationClaimCompleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_claim_completed_data import AgentRegistrationClaimCompletedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["agent.registration.claim.completed"]
|
| 24 |
+
data: AgentRegistrationClaimCompletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimCompleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "agent.registration.claim.completed"),
|
| 38 |
data=AgentRegistrationClaimCompletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationClaimCompleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_claim_completed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .agent_registration_claim_completed_data_claimed_by import (
|
|
@@ -24,7 +24,7 @@ class AgentRegistrationClaimCompletedData:
|
|
| 24 |
"""The ID of the agent registration."""
|
| 25 |
completed_by_attempt_id: str
|
| 26 |
"""The ID of the claim attempt that completed the claim."""
|
| 27 |
-
claimed_by:
|
| 28 |
"""The user who completed the claim."""
|
| 29 |
completed_at: str
|
| 30 |
"""The timestamp when the claim was completed."""
|
|
@@ -34,7 +34,7 @@ class AgentRegistrationClaimCompletedData:
|
|
| 34 |
"""The timestamp when the claim was last updated."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
@@ -43,7 +43,7 @@ class AgentRegistrationClaimCompletedData:
|
|
| 43 |
agent_registration_id=data["agent_registration_id"],
|
| 44 |
completed_by_attempt_id=data["completed_by_attempt_id"],
|
| 45 |
claimed_by=AgentRegistrationClaimCompletedDataClaimedBy.from_dict(
|
| 46 |
-
cast(
|
| 47 |
),
|
| 48 |
completed_at=data["completed_at"],
|
| 49 |
created_at=data["created_at"],
|
|
@@ -52,9 +52,9 @@ class AgentRegistrationClaimCompletedData:
|
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("AgentRegistrationClaimCompletedData", e)
|
| 54 |
|
| 55 |
-
def to_dict(self) ->
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
-
result:
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["agent_registration_id"] = self.agent_registration_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .agent_registration_claim_completed_data_claimed_by import (
|
|
|
|
| 24 |
"""The ID of the agent registration."""
|
| 25 |
completed_by_attempt_id: str
|
| 26 |
"""The ID of the claim attempt that completed the claim."""
|
| 27 |
+
claimed_by: AgentRegistrationClaimCompletedDataClaimedBy
|
| 28 |
"""The user who completed the claim."""
|
| 29 |
completed_at: str
|
| 30 |
"""The timestamp when the claim was completed."""
|
|
|
|
| 34 |
"""The timestamp when the claim was last updated."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimCompletedData:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 43 |
agent_registration_id=data["agent_registration_id"],
|
| 44 |
completed_by_attempt_id=data["completed_by_attempt_id"],
|
| 45 |
claimed_by=AgentRegistrationClaimCompletedDataClaimedBy.from_dict(
|
| 46 |
+
cast(dict[str, Any], data["claimed_by"])
|
| 47 |
),
|
| 48 |
completed_at=data["completed_at"],
|
| 49 |
created_at=data["created_at"],
|
|
|
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("AgentRegistrationClaimCompletedData", e)
|
| 54 |
|
| 55 |
+
def to_dict(self) -> dict[str, Any]:
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
+
result: dict[str, Any] = {}
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["agent_registration_id"] = self.agent_registration_id
|
python/src/workos/common/models/agent_registration_claim_completed_data_claimed_by.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,13 +14,13 @@ class AgentRegistrationClaimCompletedDataClaimedBy:
|
|
| 13 |
|
| 14 |
user_id: str
|
| 15 |
"""The ID of the user who completed the claim."""
|
| 16 |
-
organization_id:
|
| 17 |
"""The ID of the organization the claiming user belongs to."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -29,9 +30,9 @@ class AgentRegistrationClaimCompletedDataClaimedBy:
|
|
| 29 |
except (KeyError, ValueError) as e:
|
| 30 |
_raise_deserialize_error("AgentRegistrationClaimCompletedDataClaimedBy", e)
|
| 31 |
|
| 32 |
-
def to_dict(self) ->
|
| 33 |
"""Serialize to a dictionary."""
|
| 34 |
-
result:
|
| 35 |
result["user_id"] = self.user_id
|
| 36 |
result["organization_id"] = self.organization_id
|
| 37 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
user_id: str
|
| 16 |
"""The ID of the user who completed the claim."""
|
| 17 |
+
organization_id: str | Literal["null"] | None
|
| 18 |
"""The ID of the organization the claiming user belongs to."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> AgentRegistrationClaimCompletedDataClaimedBy:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("AgentRegistrationClaimCompletedDataClaimedBy", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
result["user_id"] = self.user_id
|
| 37 |
result["organization_id"] = self.organization_id
|
| 38 |
return result
|
python/src/workos/common/models/agent_registration_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_created_data import AgentRegistrationCreatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AgentRegistrationCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["agent.registration.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AgentRegistrationCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "agent.registration.created"),
|
| 39 |
data=AgentRegistrationCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_created_data import AgentRegistrationCreatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["agent.registration.created"]
|
| 24 |
+
data: AgentRegistrationCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "agent.registration.created"),
|
| 38 |
data=AgentRegistrationCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_created_data.py|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
|
|
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_created_data_agent_identity import (
|
|
@@ -24,15 +24,15 @@ class AgentRegistrationCreatedData:
|
|
| 24 |
"""Distinguishes the agent registration object."""
|
| 25 |
id: str
|
| 26 |
"""Unique identifier of the agent registration."""
|
| 27 |
-
agent_identity:
|
| 28 |
"""The agent identity for this registration."""
|
| 29 |
organization_id: str
|
| 30 |
"""The ID of the organization the registration belongs to."""
|
| 31 |
-
status:
|
| 32 |
"""The current status of the registration."""
|
| 33 |
-
kind:
|
| 34 |
"""The kind of the registration."""
|
| 35 |
-
method:
|
| 36 |
"""The authentication method of the registration."""
|
| 37 |
created_at: str
|
| 38 |
"""The timestamp when the registration was created."""
|
|
@@ -40,14 +40,14 @@ class AgentRegistrationCreatedData:
|
|
| 40 |
"""The timestamp when the registration was last updated."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
-
def from_dict(cls, data:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
| 47 |
object=data.get("object", "agent_registration"),
|
| 48 |
id=data["id"],
|
| 49 |
agent_identity=AgentRegistrationCreatedDataAgentIdentity.from_dict(
|
| 50 |
-
cast(
|
| 51 |
),
|
| 52 |
organization_id=data["organization_id"],
|
| 53 |
status=AgentRegistrationCreatedDataStatus(data["status"]),
|
|
@@ -59,9 +59,9 @@ class AgentRegistrationCreatedData:
|
|
| 59 |
except (KeyError, ValueError) as e:
|
| 60 |
_raise_deserialize_error("AgentRegistrationCreatedData", e)
|
| 61 |
|
| 62 |
-
def to_dict(self) ->
|
| 63 |
"""Serialize to a dictionary."""
|
| 64 |
-
result:
|
| 65 |
result["object"] = self.object
|
| 66 |
result["id"] = self.id
|
| 67 |
result["agent_identity"] = self.agent_identity.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_created_data_agent_identity import (
|
|
|
|
| 24 |
"""Distinguishes the agent registration object."""
|
| 25 |
id: str
|
| 26 |
"""Unique identifier of the agent registration."""
|
| 27 |
+
agent_identity: AgentRegistrationCreatedDataAgentIdentity
|
| 28 |
"""The agent identity for this registration."""
|
| 29 |
organization_id: str
|
| 30 |
"""The ID of the organization the registration belongs to."""
|
| 31 |
+
status: AgentRegistrationCreatedDataStatus
|
| 32 |
"""The current status of the registration."""
|
| 33 |
+
kind: AgentRegistrationCreatedDataKind
|
| 34 |
"""The kind of the registration."""
|
| 35 |
+
method: AgentRegistrationCreatedDataMethod
|
| 36 |
"""The authentication method of the registration."""
|
| 37 |
created_at: str
|
| 38 |
"""The timestamp when the registration was created."""
|
|
|
|
| 40 |
"""The timestamp when the registration was last updated."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationCreatedData:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
| 47 |
object=data.get("object", "agent_registration"),
|
| 48 |
id=data["id"],
|
| 49 |
agent_identity=AgentRegistrationCreatedDataAgentIdentity.from_dict(
|
| 50 |
+
cast(dict[str, Any], data["agent_identity"])
|
| 51 |
),
|
| 52 |
organization_id=data["organization_id"],
|
| 53 |
status=AgentRegistrationCreatedDataStatus(data["status"]),
|
|
|
|
| 59 |
except (KeyError, ValueError) as e:
|
| 60 |
_raise_deserialize_error("AgentRegistrationCreatedData", e)
|
| 61 |
|
| 62 |
+
def to_dict(self) -> dict[str, Any]:
|
| 63 |
"""Serialize to a dictionary."""
|
| 64 |
+
result: dict[str, Any] = {}
|
| 65 |
result["object"] = self.object
|
| 66 |
result["id"] = self.id
|
| 67 |
result["agent_identity"] = self.agent_identity.to_dict()
|
python/src/workos/common/models/agent_registration_created_data_agent_identity.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,13 +16,13 @@ class AgentRegistrationCreatedDataAgentIdentity:
|
|
| 15 |
"""Distinguishes the agent identity object."""
|
| 16 |
id: str
|
| 17 |
"""Unique identifier of the agent identity."""
|
| 18 |
-
userland_user_id:
|
| 19 |
"""The ID of the userland user bound to this agent identity."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
def from_dict(
|
| 23 |
-
cls, data:
|
| 24 |
-
) ->
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -32,9 +33,9 @@ class AgentRegistrationCreatedDataAgentIdentity:
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("AgentRegistrationCreatedDataAgentIdentity", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["object"] = self.object
|
| 39 |
result["id"] = self.id
|
| 40 |
result["userland_user_id"] = self.userland_user_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Distinguishes the agent identity object."""
|
| 17 |
id: str
|
| 18 |
"""Unique identifier of the agent identity."""
|
| 19 |
+
userland_user_id: str | Literal["null"] | None
|
| 20 |
"""The ID of the userland user bound to this agent identity."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
def from_dict(
|
| 24 |
+
cls, data: dict[str, Any]
|
| 25 |
+
) -> AgentRegistrationCreatedDataAgentIdentity:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("AgentRegistrationCreatedDataAgentIdentity", e)
|
| 35 |
|
| 36 |
+
def to_dict(self) -> dict[str, Any]:
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
+
result: dict[str, Any] = {}
|
| 39 |
result["object"] = self.object
|
| 40 |
result["id"] = self.id
|
| 41 |
result["userland_user_id"] = self.userland_user_id
|
python/src/workos/common/models/agent_registration_created_data_kind.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class AgentRegistrationCreatedDataKind(str, Enum):
|
|
| 17 |
IDENTITY_ASSERTION = "identity_assertion"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
IDENTITY_ASSERTION = "identity_assertion"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> AgentRegistrationCreatedDataKind | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/agent_registration_created_data_method.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class AgentRegistrationCreatedDataMethod(str, Enum):
|
|
| 17 |
ID_JAG = "id_jag"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
ID_JAG = "id_jag"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> AgentRegistrationCreatedDataMethod | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/agent_registration_created_data_status.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class AgentRegistrationCreatedDataStatus(str, Enum):
|
|
| 18 |
REVOKED = "revoked"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(cls, value: object) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
REVOKED = "revoked"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def _missing_(cls, value: object) -> AgentRegistrationCreatedDataStatus | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/agent_registration_credential_issued.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_credential_issued_data import (
|
| 13 |
AgentRegistrationCredentialIssuedData,
|
|
@@ -24,14 +23,14 @@ class AgentRegistrationCredentialIssued:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["agent.registration.credential.issued"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class AgentRegistrationCredentialIssued:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "agent.registration.credential.issued"),
|
| 41 |
data=AgentRegistrationCredentialIssuedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AgentRegistrationCredentialIssued", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_credential_issued_data import (
|
| 12 |
AgentRegistrationCredentialIssuedData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["agent.registration.credential.issued"]
|
| 26 |
+
data: AgentRegistrationCredentialIssuedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationCredentialIssued:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "agent.registration.credential.issued"),
|
| 40 |
data=AgentRegistrationCredentialIssuedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AgentRegistrationCredentialIssued", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_credential_issued_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .access_token_agent_registration_credential_issued_data_detail import (
|
|
@@ -25,10 +25,10 @@ class AgentRegistrationCredentialIssuedData:
|
|
| 25 |
"""Unique identifier of the agent registration credential."""
|
| 26 |
agent_registration_id: str
|
| 27 |
"""The ID of the agent registration."""
|
| 28 |
-
detail:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
"""Details of the issued credential."""
|
| 33 |
created_at: str
|
| 34 |
"""The timestamp when the credential was issued."""
|
|
@@ -36,13 +36,13 @@ class AgentRegistrationCredentialIssuedData:
|
|
| 36 |
"""The timestamp when the credential was last updated."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
-
def from_dict(cls, data:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
_detail_raw = data["detail"]
|
| 43 |
-
_detail_data = cast(
|
| 44 |
_detail_disc = cast(str, _detail_data.get("kind"))
|
| 45 |
-
_detail_disc_map:
|
| 46 |
"api_key": AgentRegistrationCredentialIssuedDataDetail,
|
| 47 |
"access_token": AccessTokenAgentRegistrationCredentialIssuedDataDetail,
|
| 48 |
}
|
|
@@ -63,9 +63,9 @@ class AgentRegistrationCredentialIssuedData:
|
|
| 63 |
except (KeyError, ValueError) as e:
|
| 64 |
_raise_deserialize_error("AgentRegistrationCredentialIssuedData", e)
|
| 65 |
|
| 66 |
-
def to_dict(self) ->
|
| 67 |
"""Serialize to a dictionary."""
|
| 68 |
-
result:
|
| 69 |
result["object"] = self.object
|
| 70 |
result["id"] = self.id
|
| 71 |
result["agent_registration_id"] = self.agent_registration_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .access_token_agent_registration_credential_issued_data_detail import (
|
|
|
|
| 25 |
"""Unique identifier of the agent registration credential."""
|
| 26 |
agent_registration_id: str
|
| 27 |
"""The ID of the agent registration."""
|
| 28 |
+
detail: (
|
| 29 |
+
AgentRegistrationCredentialIssuedDataDetail
|
| 30 |
+
| AccessTokenAgentRegistrationCredentialIssuedDataDetail
|
| 31 |
+
)
|
| 32 |
"""Details of the issued credential."""
|
| 33 |
created_at: str
|
| 34 |
"""The timestamp when the credential was issued."""
|
|
|
|
| 36 |
"""The timestamp when the credential was last updated."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationCredentialIssuedData:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
_detail_raw = data["detail"]
|
| 43 |
+
_detail_data = cast(dict[str, Any], _detail_raw)
|
| 44 |
_detail_disc = cast(str, _detail_data.get("kind"))
|
| 45 |
+
_detail_disc_map: dict[str, Any] = {
|
| 46 |
"api_key": AgentRegistrationCredentialIssuedDataDetail,
|
| 47 |
"access_token": AccessTokenAgentRegistrationCredentialIssuedDataDetail,
|
| 48 |
}
|
|
|
|
| 63 |
except (KeyError, ValueError) as e:
|
| 64 |
_raise_deserialize_error("AgentRegistrationCredentialIssuedData", e)
|
| 65 |
|
| 66 |
+
def to_dict(self) -> dict[str, Any]:
|
| 67 |
"""Serialize to a dictionary."""
|
| 68 |
+
result: dict[str, Any] = {}
|
| 69 |
result["object"] = self.object
|
| 70 |
result["id"] = self.id
|
| 71 |
result["agent_registration_id"] = self.agent_registration_id
|
python/src/workos/common/models/agent_registration_credential_issued_data_detail.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -18,8 +19,8 @@ class AgentRegistrationCredentialIssuedDataDetail:
|
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -29,9 +30,9 @@ class AgentRegistrationCredentialIssuedDataDetail:
|
|
| 29 |
except (KeyError, ValueError) as e:
|
| 30 |
_raise_deserialize_error("AgentRegistrationCredentialIssuedDataDetail", e)
|
| 31 |
|
| 32 |
-
def to_dict(self) ->
|
| 33 |
"""Serialize to a dictionary."""
|
| 34 |
-
result:
|
| 35 |
result["kind"] = self.kind
|
| 36 |
result["api_key_id"] = self.api_key_id
|
| 37 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> AgentRegistrationCredentialIssuedDataDetail:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("AgentRegistrationCredentialIssuedDataDetail", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
result["kind"] = self.kind
|
| 37 |
result["api_key_id"] = self.api_key_id
|
| 38 |
return result
|
python/src/workos/common/models/agent_registration_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_deleted_data import AgentRegistrationDeletedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AgentRegistrationDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["agent.registration.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AgentRegistrationDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "agent.registration.deleted"),
|
| 39 |
data=AgentRegistrationDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_deleted_data import AgentRegistrationDeletedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["agent.registration.deleted"]
|
| 24 |
+
data: AgentRegistrationDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "agent.registration.deleted"),
|
| 38 |
data=AgentRegistrationDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_deleted_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AgentRegistrationDeletedData:
|
|
| 15 |
"""The agent registration that was deleted."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AgentRegistrationDeletedData:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AgentRegistrationDeletedData", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["agent_registration_id"] = self.agent_registration_id
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The agent registration that was deleted."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationDeletedData:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AgentRegistrationDeletedData", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["agent_registration_id"] = self.agent_registration_id
|
| 32 |
return result
|
python/src/workos/common/models/agent_registration_expired.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_expired_data import AgentRegistrationExpiredData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AgentRegistrationExpired:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["agent.registration.expired"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AgentRegistrationExpired:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "agent.registration.expired"),
|
| 39 |
data=AgentRegistrationExpiredData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationExpired", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_expired_data import AgentRegistrationExpiredData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["agent.registration.expired"]
|
| 24 |
+
data: AgentRegistrationExpiredData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationExpired:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "agent.registration.expired"),
|
| 38 |
data=AgentRegistrationExpiredData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationExpired", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_organization_switched.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_organization_switched_data import (
|
| 13 |
AgentRegistrationOrganizationSwitchedData,
|
|
@@ -24,14 +23,14 @@ class AgentRegistrationOrganizationSwitched:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["agent.registration.organization.switched"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class AgentRegistrationOrganizationSwitched:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "agent.registration.organization.switched"),
|
| 41 |
data=AgentRegistrationOrganizationSwitchedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AgentRegistrationOrganizationSwitched", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_organization_switched_data import (
|
| 12 |
AgentRegistrationOrganizationSwitchedData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["agent.registration.organization.switched"]
|
| 26 |
+
data: AgentRegistrationOrganizationSwitchedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationOrganizationSwitched:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "agent.registration.organization.switched"),
|
| 40 |
data=AgentRegistrationOrganizationSwitchedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AgentRegistrationOrganizationSwitched", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/agent_registration_organization_switched_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -20,8 +21,8 @@ class AgentRegistrationOrganizationSwitchedData:
|
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
def from_dict(
|
| 23 |
-
cls, data:
|
| 24 |
-
) ->
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -32,9 +33,9 @@ class AgentRegistrationOrganizationSwitchedData:
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("AgentRegistrationOrganizationSwitchedData", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["agent_registration_id"] = self.agent_registration_id
|
| 39 |
result["from_organization_id"] = self.from_organization_id
|
| 40 |
result["to_organization_id"] = self.to_organization_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
def from_dict(
|
| 24 |
+
cls, data: dict[str, Any]
|
| 25 |
+
) -> AgentRegistrationOrganizationSwitchedData:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("AgentRegistrationOrganizationSwitchedData", e)
|
| 35 |
|
| 36 |
+
def to_dict(self) -> dict[str, Any]:
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
+
result: dict[str, Any] = {}
|
| 39 |
result["agent_registration_id"] = self.agent_registration_id
|
| 40 |
result["from_organization_id"] = self.from_organization_id
|
| 41 |
result["to_organization_id"] = self.to_organization_id
|
python/src/workos/common/models/agent_registration_refreshed.py|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
+
|
| 11 |
+
from .agent_registration_refreshed_data import AgentRegistrationRefreshedData
|
| 12 |
+
from .event_context import EventContext
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass(slots=True)
|
| 16 |
+
class AgentRegistrationRefreshed:
|
| 17 |
+
"""Agent Registration Refreshed model."""
|
| 18 |
+
|
| 19 |
+
object: Literal["event"]
|
| 20 |
+
"""Distinguishes the Event object."""
|
| 21 |
+
id: str
|
| 22 |
+
"""Unique identifier for the event."""
|
| 23 |
+
event: Literal["agent.registration.refreshed"]
|
| 24 |
+
data: AgentRegistrationRefreshedData
|
| 25 |
+
"""The event payload."""
|
| 26 |
+
created_at: datetime
|
| 27 |
+
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
+
|
| 30 |
+
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationRefreshed:
|
| 32 |
+
"""Deserialize from a dictionary."""
|
| 33 |
+
try:
|
| 34 |
+
return cls(
|
| 35 |
+
object=data.get("object", "event"),
|
| 36 |
+
id=data["id"],
|
| 37 |
+
event=data.get("event", "agent.registration.refreshed"),
|
| 38 |
+
data=AgentRegistrationRefreshedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
+
),
|
| 41 |
+
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
+
if (_v_context := data.get("context")) is not None
|
| 44 |
+
else None,
|
| 45 |
+
)
|
| 46 |
+
except (KeyError, ValueError) as e:
|
| 47 |
+
_raise_deserialize_error("AgentRegistrationRefreshed", e)
|
| 48 |
+
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
+
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
+
result["object"] = self.object
|
| 53 |
+
result["id"] = self.id
|
| 54 |
+
result["event"] = self.event
|
| 55 |
+
result["data"] = self.data.to_dict()
|
| 56 |
+
result["created_at"] = _format_datetime(self.created_at)
|
| 57 |
+
if self.context is not None:
|
| 58 |
+
result["context"] = self.context.to_dict()
|
| 59 |
+
return result
|
python/src/workos/common/models/agent_registration_refreshed_data.py|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
+
from .agent_registration_deleted_data import AgentRegistrationDeletedData
|
| 6 |
+
|
| 7 |
+
AgentRegistrationRefreshedData: TypeAlias = AgentRegistrationDeletedData
|
python/src/workos/common/models/agent_registration_revoked.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .agent_registration_revoked_data import AgentRegistrationRevokedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AgentRegistrationRevoked:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["agent.registration.revoked"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AgentRegistrationRevoked:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "agent.registration.revoked"),
|
| 39 |
data=AgentRegistrationRevokedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AgentRegistrationRevoked", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .agent_registration_revoked_data import AgentRegistrationRevokedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["agent.registration.revoked"]
|
| 24 |
+
data: AgentRegistrationRevokedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationRevoked:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "agent.registration.revoked"),
|
| 38 |
data=AgentRegistrationRevokedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AgentRegistrationRevoked", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/api_key_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .api_key_created_data import ApiKeyCreatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class ApiKeyCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["api_key.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "api_key.created"),
|
| 39 |
-
data=ApiKeyCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("ApiKeyCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .api_key_created_data import ApiKeyCreatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["api_key.created"]
|
| 24 |
+
data: ApiKeyCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "api_key.created"),
|
| 38 |
+
data=ApiKeyCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ApiKeyCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/api_key_created_data.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .api_key_created_data_owner import ApiKeyCreatedDataOwner
|
| 13 |
from .user_api_key_created_data_owner import UserApiKeyCreatedDataOwner
|
|
@@ -21,17 +20,17 @@ class ApiKeyCreatedData:
|
|
| 21 |
"""Distinguishes the API key object."""
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the API key."""
|
| 24 |
-
owner:
|
| 25 |
"""The owner of the API key."""
|
| 26 |
name: str
|
| 27 |
"""The name of the API key."""
|
| 28 |
obfuscated_value: str
|
| 29 |
"""The obfuscated value of the API key."""
|
| 30 |
-
last_used_at:
|
| 31 |
"""The timestamp when the API key was last used."""
|
| 32 |
-
expires_at:
|
| 33 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 34 |
-
permissions:
|
| 35 |
"""The permissions granted to the API key."""
|
| 36 |
created_at: str
|
| 37 |
"""The timestamp when the API key was created."""
|
|
@@ -39,13 +38,13 @@ class ApiKeyCreatedData:
|
|
| 39 |
"""The timestamp when the API key was last updated."""
|
| 40 |
|
| 41 |
@classmethod
|
| 42 |
-
def from_dict(cls, data:
|
| 43 |
"""Deserialize from a dictionary."""
|
| 44 |
try:
|
| 45 |
_owner_raw = data["owner"]
|
| 46 |
-
_owner_data = cast(
|
| 47 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 48 |
-
_owner_disc_map:
|
| 49 |
"organization": ApiKeyCreatedDataOwner,
|
| 50 |
"user": UserApiKeyCreatedDataOwner,
|
| 51 |
}
|
|
@@ -72,9 +71,9 @@ class ApiKeyCreatedData:
|
|
| 72 |
except (KeyError, ValueError) as e:
|
| 73 |
_raise_deserialize_error("ApiKeyCreatedData", e)
|
| 74 |
|
| 75 |
-
def to_dict(self) ->
|
| 76 |
"""Serialize to a dictionary."""
|
| 77 |
-
result:
|
| 78 |
result["object"] = self.object
|
| 79 |
result["id"] = self.id
|
| 80 |
result["owner"] = self.owner.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
|
|
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .api_key_created_data_owner import ApiKeyCreatedDataOwner
|
| 12 |
from .user_api_key_created_data_owner import UserApiKeyCreatedDataOwner
|
|
|
|
| 20 |
"""Distinguishes the API key object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the API key."""
|
| 23 |
+
owner: ApiKeyCreatedDataOwner | UserApiKeyCreatedDataOwner
|
| 24 |
"""The owner of the API key."""
|
| 25 |
name: str
|
| 26 |
"""The name of the API key."""
|
| 27 |
obfuscated_value: str
|
| 28 |
"""The obfuscated value of the API key."""
|
| 29 |
+
last_used_at: str | None
|
| 30 |
"""The timestamp when the API key was last used."""
|
| 31 |
+
expires_at: datetime | None
|
| 32 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 33 |
+
permissions: list[str]
|
| 34 |
"""The permissions granted to the API key."""
|
| 35 |
created_at: str
|
| 36 |
"""The timestamp when the API key was created."""
|
|
|
|
| 38 |
"""The timestamp when the API key was last updated."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyCreatedData:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
_owner_raw = data["owner"]
|
| 45 |
+
_owner_data = cast(dict[str, Any], _owner_raw)
|
| 46 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 47 |
+
_owner_disc_map: dict[str, Any] = {
|
| 48 |
"organization": ApiKeyCreatedDataOwner,
|
| 49 |
"user": UserApiKeyCreatedDataOwner,
|
| 50 |
}
|
|
|
|
| 71 |
except (KeyError, ValueError) as e:
|
| 72 |
_raise_deserialize_error("ApiKeyCreatedData", e)
|
| 73 |
|
| 74 |
+
def to_dict(self) -> dict[str, Any]:
|
| 75 |
"""Serialize to a dictionary."""
|
| 76 |
+
result: dict[str, Any] = {}
|
| 77 |
result["object"] = self.object
|
| 78 |
result["id"] = self.id
|
| 79 |
result["owner"] = self.owner.to_dict()
|
python/src/workos/common/models/api_key_created_data_owner.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class ApiKeyCreatedDataOwner:
|
|
| 17 |
"""The unique identifier of the API key owner."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class ApiKeyCreatedDataOwner:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("ApiKeyCreatedDataOwner", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["type"] = self.type
|
| 34 |
result["id"] = self.id
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The unique identifier of the API key owner."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyCreatedDataOwner:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ApiKeyCreatedDataOwner", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["type"] = self.type
|
| 35 |
result["id"] = self.id
|
| 36 |
return result
|
python/src/workos/common/models/api_key_revoked.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .api_key_revoked_data import ApiKeyRevokedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class ApiKeyRevoked:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["api_key.revoked"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "api_key.revoked"),
|
| 39 |
-
data=ApiKeyRevokedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("ApiKeyRevoked", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .api_key_revoked_data import ApiKeyRevokedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["api_key.revoked"]
|
| 24 |
+
data: ApiKeyRevokedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyRevoked:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "api_key.revoked"),
|
| 38 |
+
data=ApiKeyRevokedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ApiKeyRevoked", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/api_key_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .api_key_updated_data import ApiKeyUpdatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class ApiKeyUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["api_key.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "api_key.updated"),
|
| 39 |
-
data=ApiKeyUpdatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("ApiKeyUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .api_key_updated_data import ApiKeyUpdatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["api_key.updated"]
|
| 24 |
+
data: ApiKeyUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "api_key.updated"),
|
| 38 |
+
data=ApiKeyUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ApiKeyUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/api_key_updated_data.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .api_key_updated_data_owner import ApiKeyUpdatedDataOwner
|
| 13 |
from .api_key_updated_data_previous_attribute import ApiKeyUpdatedDataPreviousAttribute
|
|
@@ -22,33 +21,33 @@ class ApiKeyUpdatedData:
|
|
| 22 |
"""Distinguishes the API key object."""
|
| 23 |
id: str
|
| 24 |
"""Unique identifier of the API key."""
|
| 25 |
-
owner:
|
| 26 |
"""The owner of the API key."""
|
| 27 |
name: str
|
| 28 |
"""The name of the API key."""
|
| 29 |
obfuscated_value: str
|
| 30 |
"""The obfuscated value of the API key."""
|
| 31 |
-
last_used_at:
|
| 32 |
"""The timestamp when the API key was last used."""
|
| 33 |
-
expires_at:
|
| 34 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 35 |
-
permissions:
|
| 36 |
"""The permissions granted to the API key."""
|
| 37 |
created_at: str
|
| 38 |
"""The timestamp when the API key was created."""
|
| 39 |
updated_at: str
|
| 40 |
"""The timestamp when the API key was last updated."""
|
| 41 |
-
previous_attributes:
|
| 42 |
"""Previous API key attributes before the update."""
|
| 43 |
|
| 44 |
@classmethod
|
| 45 |
-
def from_dict(cls, data:
|
| 46 |
"""Deserialize from a dictionary."""
|
| 47 |
try:
|
| 48 |
_owner_raw = data["owner"]
|
| 49 |
-
_owner_data = cast(
|
| 50 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 51 |
-
_owner_disc_map:
|
| 52 |
"organization": ApiKeyUpdatedDataOwner,
|
| 53 |
"user": UserApiKeyUpdatedDataOwner,
|
| 54 |
}
|
|
@@ -72,15 +71,15 @@ class ApiKeyUpdatedData:
|
|
| 72 |
created_at=data["created_at"],
|
| 73 |
updated_at=data["updated_at"],
|
| 74 |
previous_attributes=ApiKeyUpdatedDataPreviousAttribute.from_dict(
|
| 75 |
-
cast(
|
| 76 |
),
|
| 77 |
)
|
| 78 |
except (KeyError, ValueError) as e:
|
| 79 |
_raise_deserialize_error("ApiKeyUpdatedData", e)
|
| 80 |
|
| 81 |
-
def to_dict(self) ->
|
| 82 |
"""Serialize to a dictionary."""
|
| 83 |
-
result:
|
| 84 |
result["object"] = self.object
|
| 85 |
result["id"] = self.id
|
| 86 |
result["owner"] = self.owner.to_dict()
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
|
|
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .api_key_updated_data_owner import ApiKeyUpdatedDataOwner
|
| 12 |
from .api_key_updated_data_previous_attribute import ApiKeyUpdatedDataPreviousAttribute
|
|
|
|
| 21 |
"""Distinguishes the API key object."""
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the API key."""
|
| 24 |
+
owner: ApiKeyUpdatedDataOwner | UserApiKeyUpdatedDataOwner
|
| 25 |
"""The owner of the API key."""
|
| 26 |
name: str
|
| 27 |
"""The name of the API key."""
|
| 28 |
obfuscated_value: str
|
| 29 |
"""The obfuscated value of the API key."""
|
| 30 |
+
last_used_at: str | None
|
| 31 |
"""The timestamp when the API key was last used."""
|
| 32 |
+
expires_at: datetime | None
|
| 33 |
"""Timestamp when the API Key expires. Null means the key does not expire."""
|
| 34 |
+
permissions: list[str]
|
| 35 |
"""The permissions granted to the API key."""
|
| 36 |
created_at: str
|
| 37 |
"""The timestamp when the API key was created."""
|
| 38 |
updated_at: str
|
| 39 |
"""The timestamp when the API key was last updated."""
|
| 40 |
+
previous_attributes: ApiKeyUpdatedDataPreviousAttribute
|
| 41 |
"""Previous API key attributes before the update."""
|
| 42 |
|
| 43 |
@classmethod
|
| 44 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyUpdatedData:
|
| 45 |
"""Deserialize from a dictionary."""
|
| 46 |
try:
|
| 47 |
_owner_raw = data["owner"]
|
| 48 |
+
_owner_data = cast(dict[str, Any], _owner_raw)
|
| 49 |
_owner_disc = cast(str, _owner_data.get("type"))
|
| 50 |
+
_owner_disc_map: dict[str, Any] = {
|
| 51 |
"organization": ApiKeyUpdatedDataOwner,
|
| 52 |
"user": UserApiKeyUpdatedDataOwner,
|
| 53 |
}
|
|
|
|
| 71 |
created_at=data["created_at"],
|
| 72 |
updated_at=data["updated_at"],
|
| 73 |
previous_attributes=ApiKeyUpdatedDataPreviousAttribute.from_dict(
|
| 74 |
+
cast(dict[str, Any], data["previous_attributes"])
|
| 75 |
),
|
| 76 |
)
|
| 77 |
except (KeyError, ValueError) as e:
|
| 78 |
_raise_deserialize_error("ApiKeyUpdatedData", e)
|
| 79 |
|
| 80 |
+
def to_dict(self) -> dict[str, Any]:
|
| 81 |
"""Serialize to a dictionary."""
|
| 82 |
+
result: dict[str, Any] = {}
|
| 83 |
result["object"] = self.object
|
| 84 |
result["id"] = self.id
|
| 85 |
result["owner"] = self.owner.to_dict()
|
python/src/workos/common/models/api_key_updated_data_previous_attribute.py|
@@ -4,20 +4,20 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
| 13 |
class ApiKeyUpdatedDataPreviousAttribute:
|
| 14 |
"""Previous API key attributes before the update."""
|
| 15 |
|
| 16 |
-
expires_at:
|
| 17 |
"""The previous timestamp when the API Key expired. Null means the key did not expire."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -28,9 +28,9 @@ class ApiKeyUpdatedDataPreviousAttribute:
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ApiKeyUpdatedDataPreviousAttribute", e)
|
| 30 |
|
| 31 |
-
def to_dict(self) ->
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
-
result:
|
| 34 |
if self.expires_at is not None:
|
| 35 |
result["expires_at"] = _format_datetime(self.expires_at)
|
| 36 |
else:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
| 13 |
class ApiKeyUpdatedDataPreviousAttribute:
|
| 14 |
"""Previous API key attributes before the update."""
|
| 15 |
|
| 16 |
+
expires_at: datetime | None
|
| 17 |
"""The previous timestamp when the API Key expired. Null means the key did not expire."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def from_dict(cls, data: dict[str, Any]) -> ApiKeyUpdatedDataPreviousAttribute:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ApiKeyUpdatedDataPreviousAttribute", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.expires_at is not None:
|
| 35 |
result["expires_at"] = _format_datetime(self.expires_at)
|
| 36 |
else:
|
python/src/workos/common/models/audit_log_configuration_log_stream_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,9 +17,7 @@ class AuditLogConfigurationLogStreamState(str, Enum):
|
|
| 18 |
INVALID = "invalid"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(
|
| 22 |
-
cls, value: object
|
| 23 |
-
) ->
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
INVALID = "invalid"
|
| 18 |
|
| 19 |
@classmethod
|
|
|
|
|
|
|
| 20 |
+
def _missing_(cls, value: object) -> AuditLogConfigurationLogStreamState | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/audit_log_configuration_log_stream_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -21,7 +20,7 @@ class AuditLogConfigurationLogStreamType(str, Enum):
|
|
| 21 |
SPLUNK = "Splunk"
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def _missing_(cls, value: object) ->
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
SPLUNK = "Splunk"
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def _missing_(cls, value: object) -> AuditLogConfigurationLogStreamType | None:
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/audit_log_configuration_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class AuditLogConfigurationState(str, Enum):
|
|
| 17 |
DISABLED = "disabled"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
DISABLED = "disabled"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> AuditLogConfigurationState | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/audit_log_export_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class AuditLogExportState(str, Enum):
|
|
| 18 |
EXPIRED = "expired"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(cls, value: object) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
EXPIRED = "expired"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def _missing_(cls, value: object) -> AuditLogExportState | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/authenticate_response_authentication_method.py|
@@ -22,6 +22,8 @@ class AuthenticateResponseAuthenticationMethod(str, Enum):
|
|
| 22 |
GIT_HUB_OAUTH = "GitHubOAuth"
|
| 23 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 24 |
GOOGLE_OAUTH = "GoogleOAuth"
|
|
|
|
|
|
|
| 25 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 26 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 27 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
@@ -58,6 +60,8 @@ AuthenticateResponseAuthenticationMethodLiteral: TypeAlias = Literal[
|
|
| 58 |
"GitHubOAuth",
|
| 59 |
"GitLabOAuth",
|
| 60 |
"GoogleOAuth",
|
|
|
|
|
|
|
| 61 |
"IntuitOAuth",
|
| 62 |
"LinkedInOAuth",
|
| 63 |
"MicrosoftOAuth",
|
|
|
|
| 22 |
GIT_HUB_OAUTH = "GitHubOAuth"
|
| 23 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 24 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 25 |
+
GROK_OAUTH = "GrokOAuth"
|
| 26 |
+
XO_AUTH = "XOAuth"
|
| 27 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 28 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 29 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
|
|
| 60 |
"GitHubOAuth",
|
| 61 |
"GitLabOAuth",
|
| 62 |
"GoogleOAuth",
|
| 63 |
+
"GrokOAuth",
|
| 64 |
+
"XOAuth",
|
| 65 |
"IntuitOAuth",
|
| 66 |
"LinkedInOAuth",
|
| 67 |
"MicrosoftOAuth",
|
python/src/workos/common/models/authentication_challenge.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -23,13 +23,13 @@ class AuthenticationChallenge:
|
|
| 23 |
"""An ISO 8601 timestamp."""
|
| 24 |
updated_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
-
expires_at:
|
| 27 |
"""The timestamp when the challenge will expire. Does not apply to TOTP factors."""
|
| 28 |
-
code:
|
| 29 |
"""The one-time code for the challenge."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -46,9 +46,9 @@ class AuthenticationChallenge:
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationChallenge", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["authentication_factor_id"] = self.authentication_factor_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 23 |
"""An ISO 8601 timestamp."""
|
| 24 |
updated_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
+
expires_at: datetime | None = None
|
| 27 |
"""The timestamp when the challenge will expire. Does not apply to TOTP factors."""
|
| 28 |
+
code: str | None = None
|
| 29 |
"""The one-time code for the challenge."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationChallenge:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationChallenge", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["authentication_factor_id"] = self.authentication_factor_id
|
python/src/workos/common/models/authentication_email_verification_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_email_verification_failed_data import (
|
| 13 |
AuthenticationEmailVerificationFailedData,
|
|
@@ -24,14 +23,14 @@ class AuthenticationEmailVerificationFailed:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["authentication.email_verification_failed"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class AuthenticationEmailVerificationFailed:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "authentication.email_verification_failed"),
|
| 41 |
data=AuthenticationEmailVerificationFailedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuthenticationEmailVerificationFailed", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_email_verification_failed_data import (
|
| 12 |
AuthenticationEmailVerificationFailedData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["authentication.email_verification_failed"]
|
| 26 |
+
data: AuthenticationEmailVerificationFailedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationEmailVerificationFailed:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "authentication.email_verification_failed"),
|
| 40 |
data=AuthenticationEmailVerificationFailedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AuthenticationEmailVerificationFailed", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_email_verification_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_email_verification_failed_data_error import (
|
|
@@ -18,21 +18,21 @@ class AuthenticationEmailVerificationFailedData:
|
|
| 18 |
|
| 19 |
type: Literal["email_verification"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
-
ip_address:
|
| 22 |
"""The IP address of the request."""
|
| 23 |
-
user_agent:
|
| 24 |
"""The user agent of the request."""
|
| 25 |
-
user_id:
|
| 26 |
"""The ID of the user."""
|
| 27 |
-
email:
|
| 28 |
"""The email address of the user."""
|
| 29 |
-
error:
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
-
cls, data:
|
| 35 |
-
) ->
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -43,15 +43,15 @@ class AuthenticationEmailVerificationFailedData:
|
|
| 43 |
user_id=data["user_id"],
|
| 44 |
email=data["email"],
|
| 45 |
error=AuthenticationEmailVerificationFailedDataError.from_dict(
|
| 46 |
-
cast(
|
| 47 |
),
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuthenticationEmailVerificationFailedData", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["type"] = self.type
|
| 56 |
result["status"] = self.status
|
| 57 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_email_verification_failed_data_error import (
|
|
|
|
| 18 |
|
| 19 |
type: Literal["email_verification"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
+
ip_address: str | None
|
| 22 |
"""The IP address of the request."""
|
| 23 |
+
user_agent: str | None
|
| 24 |
"""The user agent of the request."""
|
| 25 |
+
user_id: str | None
|
| 26 |
"""The ID of the user."""
|
| 27 |
+
email: str | None
|
| 28 |
"""The email address of the user."""
|
| 29 |
+
error: AuthenticationEmailVerificationFailedDataError
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
+
cls, data: dict[str, Any]
|
| 35 |
+
) -> AuthenticationEmailVerificationFailedData:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 43 |
user_id=data["user_id"],
|
| 44 |
email=data["email"],
|
| 45 |
error=AuthenticationEmailVerificationFailedDataError.from_dict(
|
| 46 |
+
cast(dict[str, Any], data["error"])
|
| 47 |
),
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuthenticationEmailVerificationFailedData", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["type"] = self.type
|
| 56 |
result["status"] = self.status
|
| 57 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_email_verification_failed_data_error.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -18,8 +19,8 @@ class AuthenticationEmailVerificationFailedDataError:
|
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -31,9 +32,9 @@ class AuthenticationEmailVerificationFailedDataError:
|
|
| 31 |
"AuthenticationEmailVerificationFailedDataError", e
|
| 32 |
)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["code"] = self.code
|
| 38 |
result["message"] = self.message
|
| 39 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> AuthenticationEmailVerificationFailedDataError:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 32 |
"AuthenticationEmailVerificationFailedDataError", e
|
| 33 |
)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["code"] = self.code
|
| 39 |
result["message"] = self.message
|
| 40 |
return result
|
python/src/workos/common/models/authentication_email_verification_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_email_verification_succeeded_data import (
|
| 13 |
AuthenticationEmailVerificationSucceededData,
|
|
@@ -24,16 +23,16 @@ class AuthenticationEmailVerificationSucceeded:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["authentication.email_verification_succeeded"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
def from_dict(
|
| 35 |
-
cls, data:
|
| 36 |
-
) ->
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -41,19 +40,19 @@ class AuthenticationEmailVerificationSucceeded:
|
|
| 41 |
id=data["id"],
|
| 42 |
event=data.get("event", "authentication.email_verification_succeeded"),
|
| 43 |
data=AuthenticationEmailVerificationSucceededData.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
created_at=_parse_datetime(data["created_at"]),
|
| 47 |
-
context=EventContext.from_dict(cast(
|
| 48 |
if (_v_context := data.get("context")) is not None
|
| 49 |
else None,
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationEmailVerificationSucceeded", e)
|
| 53 |
|
| 54 |
-
def to_dict(self) ->
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
-
result:
|
| 57 |
result["object"] = self.object
|
| 58 |
result["id"] = self.id
|
| 59 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_email_verification_succeeded_data import (
|
| 12 |
AuthenticationEmailVerificationSucceededData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["authentication.email_verification_succeeded"]
|
| 26 |
+
data: AuthenticationEmailVerificationSucceededData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
+
cls, data: dict[str, Any]
|
| 35 |
+
) -> AuthenticationEmailVerificationSucceeded:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 40 |
id=data["id"],
|
| 41 |
event=data.get("event", "authentication.email_verification_succeeded"),
|
| 42 |
data=AuthenticationEmailVerificationSucceededData.from_dict(
|
| 43 |
+
cast(dict[str, Any], data["data"])
|
| 44 |
),
|
| 45 |
created_at=_parse_datetime(data["created_at"]),
|
| 46 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 47 |
if (_v_context := data.get("context")) is not None
|
| 48 |
else None,
|
| 49 |
)
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("AuthenticationEmailVerificationSucceeded", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_email_verification_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationEmailVerificationSucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["email_verification"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -24,8 +25,8 @@ class AuthenticationEmailVerificationSucceededData:
|
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
def from_dict(
|
| 27 |
-
cls, data:
|
| 28 |
-
) ->
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -39,9 +40,9 @@ class AuthenticationEmailVerificationSucceededData:
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("AuthenticationEmailVerificationSucceededData", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["type"] = self.type
|
| 46 |
result["status"] = self.status
|
| 47 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["email_verification"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
def from_dict(
|
| 28 |
+
cls, data: dict[str, Any]
|
| 29 |
+
) -> AuthenticationEmailVerificationSucceededData:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("AuthenticationEmailVerificationSucceededData", e)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["type"] = self.type
|
| 47 |
result["status"] = self.status
|
| 48 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_factor.py|
@@ -5,10 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .authentication_factor_sms import AuthenticationFactorSms
|
| 14 |
from .authentication_factor_totp import AuthenticationFactorTotp
|
|
@@ -23,21 +22,21 @@ class AuthenticationFactor:
|
|
| 23 |
"""Distinguishes the authentication factor object."""
|
| 24 |
id: str
|
| 25 |
"""The unique ID of the factor."""
|
| 26 |
-
type:
|
| 27 |
"""The type of the factor to enroll."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
-
user_id:
|
| 33 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 34 |
-
sms:
|
| 35 |
"""SMS-based authentication factor details."""
|
| 36 |
-
totp:
|
| 37 |
"""TOTP-based authentication factor details."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
-
def from_dict(cls, data:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
@@ -47,19 +46,19 @@ class AuthenticationFactor:
|
|
| 47 |
created_at=_parse_datetime(data["created_at"]),
|
| 48 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 49 |
user_id=data.get("user_id"),
|
| 50 |
-
sms=AuthenticationFactorSms.from_dict(cast(
|
| 51 |
if (_v_sms := data.get("sms")) is not None
|
| 52 |
else None,
|
| 53 |
-
totp=AuthenticationFactorTotp.from_dict(cast(
|
| 54 |
if (_v_totp := data.get("totp")) is not None
|
| 55 |
else None,
|
| 56 |
)
|
| 57 |
except (KeyError, ValueError) as e:
|
| 58 |
_raise_deserialize_error("AuthenticationFactor", e)
|
| 59 |
|
| 60 |
-
def to_dict(self) ->
|
| 61 |
"""Serialize to a dictionary."""
|
| 62 |
-
result:
|
| 63 |
result["object"] = self.object
|
| 64 |
result["id"] = self.id
|
| 65 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .authentication_factor_sms import AuthenticationFactorSms
|
| 13 |
from .authentication_factor_totp import AuthenticationFactorTotp
|
|
|
|
| 22 |
"""Distinguishes the authentication factor object."""
|
| 23 |
id: str
|
| 24 |
"""The unique ID of the factor."""
|
| 25 |
+
type: AuthenticationFactorType
|
| 26 |
"""The type of the factor to enroll."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
updated_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
+
user_id: str | None = None
|
| 32 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 33 |
+
sms: AuthenticationFactorSms | None = None
|
| 34 |
"""SMS-based authentication factor details."""
|
| 35 |
+
totp: AuthenticationFactorTotp | None = None
|
| 36 |
"""TOTP-based authentication factor details."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactor:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
return cls(
|
|
|
|
| 46 |
created_at=_parse_datetime(data["created_at"]),
|
| 47 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 48 |
user_id=data.get("user_id"),
|
| 49 |
+
sms=AuthenticationFactorSms.from_dict(cast(dict[str, Any], _v_sms))
|
| 50 |
if (_v_sms := data.get("sms")) is not None
|
| 51 |
else None,
|
| 52 |
+
totp=AuthenticationFactorTotp.from_dict(cast(dict[str, Any], _v_totp))
|
| 53 |
if (_v_totp := data.get("totp")) is not None
|
| 54 |
else None,
|
| 55 |
)
|
| 56 |
except (KeyError, ValueError) as e:
|
| 57 |
_raise_deserialize_error("AuthenticationFactor", e)
|
| 58 |
|
| 59 |
+
def to_dict(self) -> dict[str, Any]:
|
| 60 |
"""Serialize to a dictionary."""
|
| 61 |
+
result: dict[str, Any] = {}
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
| 64 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
python/src/workos/common/models/authentication_factor_enrolled.py|
@@ -5,10 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .authentication_factor_enrolled_sms import AuthenticationFactorEnrolledSms
|
| 14 |
from .authentication_factor_enrolled_totp import AuthenticationFactorEnrolledTotp
|
|
@@ -23,21 +22,21 @@ class AuthenticationFactorEnrolled:
|
|
| 23 |
"""Distinguishes the authentication factor object."""
|
| 24 |
id: str
|
| 25 |
"""The unique ID of the factor."""
|
| 26 |
-
type:
|
| 27 |
"""The type of the factor to enroll."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
-
user_id:
|
| 33 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 34 |
-
sms:
|
| 35 |
"""SMS-based authentication factor details."""
|
| 36 |
-
totp:
|
| 37 |
"""TOTP-based authentication factor details. Includes enrollment secrets only available at creation time."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
-
def from_dict(cls, data:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
@@ -48,12 +47,12 @@ class AuthenticationFactorEnrolled:
|
|
| 48 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 49 |
user_id=data.get("user_id"),
|
| 50 |
sms=AuthenticationFactorEnrolledSms.from_dict(
|
| 51 |
-
cast(
|
| 52 |
)
|
| 53 |
if (_v_sms := data.get("sms")) is not None
|
| 54 |
else None,
|
| 55 |
totp=AuthenticationFactorEnrolledTotp.from_dict(
|
| 56 |
-
cast(
|
| 57 |
)
|
| 58 |
if (_v_totp := data.get("totp")) is not None
|
| 59 |
else None,
|
|
@@ -61,9 +60,9 @@ class AuthenticationFactorEnrolled:
|
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("AuthenticationFactorEnrolled", e)
|
| 63 |
|
| 64 |
-
def to_dict(self) ->
|
| 65 |
"""Serialize to a dictionary."""
|
| 66 |
-
result:
|
| 67 |
result["object"] = self.object
|
| 68 |
result["id"] = self.id
|
| 69 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .authentication_factor_enrolled_sms import AuthenticationFactorEnrolledSms
|
| 13 |
from .authentication_factor_enrolled_totp import AuthenticationFactorEnrolledTotp
|
|
|
|
| 22 |
"""Distinguishes the authentication factor object."""
|
| 23 |
id: str
|
| 24 |
"""The unique ID of the factor."""
|
| 25 |
+
type: AuthenticationFactorEnrolledType
|
| 26 |
"""The type of the factor to enroll."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
updated_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
+
user_id: str | None = None
|
| 32 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 33 |
+
sms: AuthenticationFactorEnrolledSms | None = None
|
| 34 |
"""SMS-based authentication factor details."""
|
| 35 |
+
totp: AuthenticationFactorEnrolledTotp | None = None
|
| 36 |
"""TOTP-based authentication factor details. Includes enrollment secrets only available at creation time."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactorEnrolled:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
return cls(
|
|
|
|
| 47 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 48 |
user_id=data.get("user_id"),
|
| 49 |
sms=AuthenticationFactorEnrolledSms.from_dict(
|
| 50 |
+
cast(dict[str, Any], _v_sms)
|
| 51 |
)
|
| 52 |
if (_v_sms := data.get("sms")) is not None
|
| 53 |
else None,
|
| 54 |
totp=AuthenticationFactorEnrolledTotp.from_dict(
|
| 55 |
+
cast(dict[str, Any], _v_totp)
|
| 56 |
)
|
| 57 |
if (_v_totp := data.get("totp")) is not None
|
| 58 |
else None,
|
|
|
|
| 60 |
except (KeyError, ValueError) as e:
|
| 61 |
_raise_deserialize_error("AuthenticationFactorEnrolled", e)
|
| 62 |
|
| 63 |
+
def to_dict(self) -> dict[str, Any]:
|
| 64 |
"""Serialize to a dictionary."""
|
| 65 |
+
result: dict[str, Any] = {}
|
| 66 |
result["object"] = self.object
|
| 67 |
result["id"] = self.id
|
| 68 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
python/src/workos/common/models/authentication_factor_enrolled_sms.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AuthenticationFactorEnrolledSms:
|
|
| 15 |
"""The user's phone number for SMS-based authentication."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AuthenticationFactorEnrolledSms:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuthenticationFactorEnrolledSms", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["phone_number"] = self.phone_number
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The user's phone number for SMS-based authentication."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactorEnrolledSms:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuthenticationFactorEnrolledSms", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["phone_number"] = self.phone_number
|
| 32 |
return result
|
python/src/workos/common/models/authentication_factor_enrolled_totp.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -23,7 +24,7 @@ class AuthenticationFactorEnrolledTotp:
|
|
| 23 |
"""The `otpauth` URI that is encoded by the provided `qr_code`."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -36,9 +37,9 @@ class AuthenticationFactorEnrolledTotp:
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("AuthenticationFactorEnrolledTotp", e)
|
| 38 |
|
| 39 |
-
def to_dict(self) ->
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
-
result:
|
| 42 |
result["issuer"] = self.issuer
|
| 43 |
result["user"] = self.user
|
| 44 |
result["secret"] = self.secret
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 24 |
"""The `otpauth` URI that is encoded by the provided `qr_code`."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactorEnrolledTotp:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationFactorEnrolledTotp", e)
|
| 39 |
|
| 40 |
+
def to_dict(self) -> dict[str, Any]:
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
+
result: dict[str, Any] = {}
|
| 43 |
result["issuer"] = self.issuer
|
| 44 |
result["user"] = self.user
|
| 45 |
result["secret"] = self.secret
|
python/src/workos/common/models/authentication_factor_enrolled_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class AuthenticationFactorEnrolledType(str, Enum):
|
|
| 18 |
WEBAUTHN = "webauthn"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(cls, value: object) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
WEBAUTHN = "webauthn"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def _missing_(cls, value: object) -> AuthenticationFactorEnrolledType | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/authentication_factor_totp.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class AuthenticationFactorTotp:
|
|
| 17 |
"""The user's account name displayed in their authenticator app. Defaults to the user's email."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class AuthenticationFactorTotp:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("AuthenticationFactorTotp", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["issuer"] = self.issuer
|
| 34 |
result["user"] = self.user
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The user's account name displayed in their authenticator app. Defaults to the user's email."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactorTotp:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("AuthenticationFactorTotp", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["issuer"] = self.issuer
|
| 35 |
result["user"] = self.user
|
| 36 |
return result
|
python/src/workos/common/models/authentication_factors_create_request_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,9 +16,7 @@ class AuthenticationFactorsCreateRequestType(str, Enum):
|
|
| 17 |
TOTP = "totp"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(
|
| 21 |
-
cls, value: object
|
| 22 |
-
) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
TOTP = "totp"
|
| 17 |
|
| 18 |
@classmethod
|
|
|
|
|
|
|
| 19 |
+
def _missing_(cls, value: object) -> AuthenticationFactorsCreateRequestType | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/authentication_magic_auth_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_magic_auth_failed_data import AuthenticationMagicAuthFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationMagicAuthFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.magic_auth_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationMagicAuthFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.magic_auth_failed"),
|
| 39 |
data=AuthenticationMagicAuthFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationMagicAuthFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_magic_auth_failed_data import AuthenticationMagicAuthFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.magic_auth_failed"]
|
| 24 |
+
data: AuthenticationMagicAuthFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMagicAuthFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.magic_auth_failed"),
|
| 38 |
data=AuthenticationMagicAuthFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationMagicAuthFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_magic_auth_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_magic_auth_failed_data_error import (
|
|
@@ -18,19 +18,19 @@ class AuthenticationMagicAuthFailedData:
|
|
| 18 |
|
| 19 |
type: Literal["magic_auth"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
-
ip_address:
|
| 22 |
"""The IP address of the request."""
|
| 23 |
-
user_agent:
|
| 24 |
"""The user agent of the request."""
|
| 25 |
-
user_id:
|
| 26 |
"""The ID of the user."""
|
| 27 |
-
email:
|
| 28 |
"""The email address of the user."""
|
| 29 |
-
error:
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
@@ -41,15 +41,15 @@ class AuthenticationMagicAuthFailedData:
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationMagicAuthFailedDataError.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationMagicAuthFailedData", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_magic_auth_failed_data_error import (
|
|
|
|
| 18 |
|
| 19 |
type: Literal["magic_auth"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
+
ip_address: str | None
|
| 22 |
"""The IP address of the request."""
|
| 23 |
+
user_agent: str | None
|
| 24 |
"""The user agent of the request."""
|
| 25 |
+
user_id: str | None
|
| 26 |
"""The ID of the user."""
|
| 27 |
+
email: str | None
|
| 28 |
"""The email address of the user."""
|
| 29 |
+
error: AuthenticationMagicAuthFailedDataError
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMagicAuthFailedData:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationMagicAuthFailedDataError.from_dict(
|
| 44 |
+
cast(dict[str, Any], data["error"])
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationMagicAuthFailedData", e)
|
| 49 |
|
| 50 |
+
def to_dict(self) -> dict[str, Any]:
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
+
result: dict[str, Any] = {}
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_magic_auth_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_magic_auth_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_magic_auth_succeeded_data import (
|
| 13 |
AuthenticationMagicAuthSucceededData,
|
|
@@ -24,14 +23,14 @@ class AuthenticationMagicAuthSucceeded:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["authentication.magic_auth_succeeded"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class AuthenticationMagicAuthSucceeded:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "authentication.magic_auth_succeeded"),
|
| 41 |
data=AuthenticationMagicAuthSucceededData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("AuthenticationMagicAuthSucceeded", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_magic_auth_succeeded_data import (
|
| 12 |
AuthenticationMagicAuthSucceededData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["authentication.magic_auth_succeeded"]
|
| 26 |
+
data: AuthenticationMagicAuthSucceededData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMagicAuthSucceeded:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "authentication.magic_auth_succeeded"),
|
| 40 |
data=AuthenticationMagicAuthSucceededData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AuthenticationMagicAuthSucceeded", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_magic_auth_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationMagicAuthSucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["magic_auth"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -23,7 +24,7 @@ class AuthenticationMagicAuthSucceededData:
|
|
| 23 |
"""The email address of the user."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -37,9 +38,9 @@ class AuthenticationMagicAuthSucceededData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationMagicAuthSucceededData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["type"] = self.type
|
| 44 |
result["status"] = self.status
|
| 45 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["magic_auth"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 24 |
"""The email address of the user."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMagicAuthSucceededData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AuthenticationMagicAuthSucceededData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["type"] = self.type
|
| 45 |
result["status"] = self.status
|
| 46 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_mfa_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_mfa_failed_data import AuthenticationMFAFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationMFAFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.mfa_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationMFAFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.mfa_failed"),
|
| 39 |
data=AuthenticationMFAFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationMFAFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_mfa_failed_data import AuthenticationMFAFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.mfa_failed"]
|
| 24 |
+
data: AuthenticationMFAFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMFAFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.mfa_failed"),
|
| 38 |
data=AuthenticationMFAFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationMFAFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_mfa_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_mfa_failed_data_error import AuthenticationMFAFailedDataError
|
|
@@ -16,19 +16,19 @@ class AuthenticationMFAFailedData:
|
|
| 16 |
|
| 17 |
type: Literal["mfa"]
|
| 18 |
status: Literal["failed"]
|
| 19 |
-
ip_address:
|
| 20 |
"""The IP address of the request."""
|
| 21 |
-
user_agent:
|
| 22 |
"""The user agent of the request."""
|
| 23 |
-
user_id:
|
| 24 |
"""The ID of the user."""
|
| 25 |
-
email:
|
| 26 |
"""The email address of the user."""
|
| 27 |
-
error:
|
| 28 |
"""Details about the authentication error."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -39,15 +39,15 @@ class AuthenticationMFAFailedData:
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
error=AuthenticationMFAFailedDataError.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationMFAFailedData", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_mfa_failed_data_error import AuthenticationMFAFailedDataError
|
|
|
|
| 16 |
|
| 17 |
type: Literal["mfa"]
|
| 18 |
status: Literal["failed"]
|
| 19 |
+
ip_address: str | None
|
| 20 |
"""The IP address of the request."""
|
| 21 |
+
user_agent: str | None
|
| 22 |
"""The user agent of the request."""
|
| 23 |
+
user_id: str | None
|
| 24 |
"""The ID of the user."""
|
| 25 |
+
email: str | None
|
| 26 |
"""The email address of the user."""
|
| 27 |
+
error: AuthenticationMFAFailedDataError
|
| 28 |
"""Details about the authentication error."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMFAFailedData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
error=AuthenticationMFAFailedDataError.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["error"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationMFAFailedData", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_mfa_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_mfa_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_mfa_succeeded_data import AuthenticationMFASucceededData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationMFASucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.mfa_succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationMFASucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.mfa_succeeded"),
|
| 39 |
data=AuthenticationMFASucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationMFASucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_mfa_succeeded_data import AuthenticationMFASucceededData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.mfa_succeeded"]
|
| 24 |
+
data: AuthenticationMFASucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMFASucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.mfa_succeeded"),
|
| 38 |
data=AuthenticationMFASucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationMFASucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_mfa_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationMFASucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["mfa"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -23,7 +24,7 @@ class AuthenticationMFASucceededData:
|
|
| 23 |
"""The email address of the user."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -37,9 +38,9 @@ class AuthenticationMFASucceededData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationMFASucceededData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["type"] = self.type
|
| 44 |
result["status"] = self.status
|
| 45 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["mfa"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 24 |
"""The email address of the user."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationMFASucceededData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AuthenticationMFASucceededData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["type"] = self.type
|
| 45 |
result["status"] = self.status
|
| 46 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_oauth_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_oauth_failed_data import AuthenticationOAuthFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationOAuthFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.oauth_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationOAuthFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.oauth_failed"),
|
| 39 |
data=AuthenticationOAuthFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationOAuthFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_oauth_failed_data import AuthenticationOAuthFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.oauth_failed"]
|
| 24 |
+
data: AuthenticationOAuthFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationOAuthFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.oauth_failed"),
|
| 38 |
data=AuthenticationOAuthFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationOAuthFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_oauth_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_oauth_failed_data_error import AuthenticationOAuthFailedDataError
|
|
@@ -16,19 +16,19 @@ class AuthenticationOAuthFailedData:
|
|
| 16 |
|
| 17 |
type: Literal["oauth"]
|
| 18 |
status: Literal["failed"]
|
| 19 |
-
ip_address:
|
| 20 |
"""The IP address of the request."""
|
| 21 |
-
user_agent:
|
| 22 |
"""The user agent of the request."""
|
| 23 |
-
user_id:
|
| 24 |
"""The ID of the user."""
|
| 25 |
-
email:
|
| 26 |
"""The email address of the user."""
|
| 27 |
-
error:
|
| 28 |
"""Details about the authentication error."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -39,15 +39,15 @@ class AuthenticationOAuthFailedData:
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
error=AuthenticationOAuthFailedDataError.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationOAuthFailedData", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_oauth_failed_data_error import AuthenticationOAuthFailedDataError
|
|
|
|
| 16 |
|
| 17 |
type: Literal["oauth"]
|
| 18 |
status: Literal["failed"]
|
| 19 |
+
ip_address: str | None
|
| 20 |
"""The IP address of the request."""
|
| 21 |
+
user_agent: str | None
|
| 22 |
"""The user agent of the request."""
|
| 23 |
+
user_id: str | None
|
| 24 |
"""The ID of the user."""
|
| 25 |
+
email: str | None
|
| 26 |
"""The email address of the user."""
|
| 27 |
+
error: AuthenticationOAuthFailedDataError
|
| 28 |
"""Details about the authentication error."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationOAuthFailedData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
error=AuthenticationOAuthFailedDataError.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["error"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationOAuthFailedData", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_oauth_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_oauth_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_oauth_succeeded_data import AuthenticationOAuthSucceededData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationOAuthSucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.oauth_succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationOAuthSucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.oauth_succeeded"),
|
| 39 |
data=AuthenticationOAuthSucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationOAuthSucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_oauth_succeeded_data import AuthenticationOAuthSucceededData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.oauth_succeeded"]
|
| 24 |
+
data: AuthenticationOAuthSucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationOAuthSucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.oauth_succeeded"),
|
| 38 |
data=AuthenticationOAuthSucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationOAuthSucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_oauth_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,17 +14,17 @@ class AuthenticationOAuthSucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["oauth"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
-
user_id:
|
| 21 |
"""The ID of the user."""
|
| 22 |
email: str
|
| 23 |
"""The email address of the user."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -37,9 +38,9 @@ class AuthenticationOAuthSucceededData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationOAuthSucceededData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["type"] = self.type
|
| 44 |
result["status"] = self.status
|
| 45 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["oauth"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
+
user_id: str | None
|
| 22 |
"""The ID of the user."""
|
| 23 |
email: str
|
| 24 |
"""The email address of the user."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationOAuthSucceededData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AuthenticationOAuthSucceededData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["type"] = self.type
|
| 45 |
result["status"] = self.status
|
| 46 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_passkey_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_passkey_failed_data import AuthenticationPasskeyFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationPasskeyFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.passkey_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationPasskeyFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.passkey_failed"),
|
| 39 |
data=AuthenticationPasskeyFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasskeyFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_passkey_failed_data import AuthenticationPasskeyFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.passkey_failed"]
|
| 24 |
+
data: AuthenticationPasskeyFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasskeyFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.passkey_failed"),
|
| 38 |
data=AuthenticationPasskeyFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationPasskeyFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_passkey_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_passkey_failed_data_error import (
|
|
@@ -18,19 +18,19 @@ class AuthenticationPasskeyFailedData:
|
|
| 18 |
|
| 19 |
type: Literal["passkey"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
-
ip_address:
|
| 22 |
"""The IP address of the request."""
|
| 23 |
-
user_agent:
|
| 24 |
"""The user agent of the request."""
|
| 25 |
-
user_id:
|
| 26 |
"""The ID of the user."""
|
| 27 |
-
email:
|
| 28 |
"""The email address of the user."""
|
| 29 |
-
error:
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
@@ -41,15 +41,15 @@ class AuthenticationPasskeyFailedData:
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationPasskeyFailedDataError.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasskeyFailedData", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_passkey_failed_data_error import (
|
|
|
|
| 18 |
|
| 19 |
type: Literal["passkey"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
+
ip_address: str | None
|
| 22 |
"""The IP address of the request."""
|
| 23 |
+
user_agent: str | None
|
| 24 |
"""The user agent of the request."""
|
| 25 |
+
user_id: str | None
|
| 26 |
"""The ID of the user."""
|
| 27 |
+
email: str | None
|
| 28 |
"""The email address of the user."""
|
| 29 |
+
error: AuthenticationPasskeyFailedDataError
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasskeyFailedData:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationPasskeyFailedDataError.from_dict(
|
| 44 |
+
cast(dict[str, Any], data["error"])
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasskeyFailedData", e)
|
| 49 |
|
| 50 |
+
def to_dict(self) -> dict[str, Any]:
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
+
result: dict[str, Any] = {}
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_passkey_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_passkey_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_passkey_succeeded_data import AuthenticationPasskeySucceededData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationPasskeySucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.passkey_succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationPasskeySucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.passkey_succeeded"),
|
| 39 |
data=AuthenticationPasskeySucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasskeySucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_passkey_succeeded_data import AuthenticationPasskeySucceededData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.passkey_succeeded"]
|
| 24 |
+
data: AuthenticationPasskeySucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasskeySucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.passkey_succeeded"),
|
| 38 |
data=AuthenticationPasskeySucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationPasskeySucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_passkey_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationPasskeySucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["passkey"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -23,7 +24,7 @@ class AuthenticationPasskeySucceededData:
|
|
| 23 |
"""The email address of the user."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -37,9 +38,9 @@ class AuthenticationPasskeySucceededData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationPasskeySucceededData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["type"] = self.type
|
| 44 |
result["status"] = self.status
|
| 45 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["passkey"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 24 |
"""The email address of the user."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasskeySucceededData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AuthenticationPasskeySucceededData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["type"] = self.type
|
| 45 |
result["status"] = self.status
|
| 46 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_password_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_password_failed_data import AuthenticationPasswordFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationPasswordFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.password_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationPasswordFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.password_failed"),
|
| 39 |
data=AuthenticationPasswordFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasswordFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_password_failed_data import AuthenticationPasswordFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.password_failed"]
|
| 24 |
+
data: AuthenticationPasswordFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasswordFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.password_failed"),
|
| 38 |
data=AuthenticationPasswordFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationPasswordFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_password_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_password_failed_data_error import (
|
|
@@ -18,19 +18,19 @@ class AuthenticationPasswordFailedData:
|
|
| 18 |
|
| 19 |
type: Literal["password"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
-
ip_address:
|
| 22 |
"""The IP address of the request."""
|
| 23 |
-
user_agent:
|
| 24 |
"""The user agent of the request."""
|
| 25 |
-
user_id:
|
| 26 |
"""The ID of the user."""
|
| 27 |
-
email:
|
| 28 |
"""The email address of the user."""
|
| 29 |
-
error:
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
@@ -41,15 +41,15 @@ class AuthenticationPasswordFailedData:
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationPasswordFailedDataError.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasswordFailedData", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_password_failed_data_error import (
|
|
|
|
| 18 |
|
| 19 |
type: Literal["password"]
|
| 20 |
status: Literal["failed"]
|
| 21 |
+
ip_address: str | None
|
| 22 |
"""The IP address of the request."""
|
| 23 |
+
user_agent: str | None
|
| 24 |
"""The user agent of the request."""
|
| 25 |
+
user_id: str | None
|
| 26 |
"""The ID of the user."""
|
| 27 |
+
email: str | None
|
| 28 |
"""The email address of the user."""
|
| 29 |
+
error: AuthenticationPasswordFailedDataError
|
| 30 |
"""Details about the authentication error."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasswordFailedData:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 41 |
user_id=data["user_id"],
|
| 42 |
email=data["email"],
|
| 43 |
error=AuthenticationPasswordFailedDataError.from_dict(
|
| 44 |
+
cast(dict[str, Any], data["error"])
|
| 45 |
),
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasswordFailedData", e)
|
| 49 |
|
| 50 |
+
def to_dict(self) -> dict[str, Any]:
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
+
result: dict[str, Any] = {}
|
| 53 |
result["type"] = self.type
|
| 54 |
result["status"] = self.status
|
| 55 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_password_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_password_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_password_succeeded_data import AuthenticationPasswordSucceededData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationPasswordSucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.password_succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationPasswordSucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.password_succeeded"),
|
| 39 |
data=AuthenticationPasswordSucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationPasswordSucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_password_succeeded_data import AuthenticationPasswordSucceededData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.password_succeeded"]
|
| 24 |
+
data: AuthenticationPasswordSucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasswordSucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.password_succeeded"),
|
| 38 |
data=AuthenticationPasswordSucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationPasswordSucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_password_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationPasswordSucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["password"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -23,7 +24,7 @@ class AuthenticationPasswordSucceededData:
|
|
| 23 |
"""The email address of the user."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -37,9 +38,9 @@ class AuthenticationPasswordSucceededData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("AuthenticationPasswordSucceededData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["type"] = self.type
|
| 44 |
result["status"] = self.status
|
| 45 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["password"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 24 |
"""The email address of the user."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationPasswordSucceededData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("AuthenticationPasswordSucceededData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["type"] = self.type
|
| 45 |
result["status"] = self.status
|
| 46 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_radar_risk_detected.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_radar_risk_detected_data import AuthenticationRadarRiskDetectedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationRadarRiskDetected:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.radar_risk_detected"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationRadarRiskDetected:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.radar_risk_detected"),
|
| 39 |
data=AuthenticationRadarRiskDetectedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationRadarRiskDetected", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_radar_risk_detected_data import AuthenticationRadarRiskDetectedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.radar_risk_detected"]
|
| 24 |
+
data: AuthenticationRadarRiskDetectedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationRadarRiskDetected:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.radar_risk_detected"),
|
| 38 |
data=AuthenticationRadarRiskDetectedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationRadarRiskDetected", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_radar_risk_detected_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .authentication_radar_risk_detected_data_action import (
|
| 10 |
AuthenticationRadarRiskDetectedDataAction,
|
| 11 |
)
|
|
@@ -17,14 +19,14 @@ class AuthenticationRadarRiskDetectedData:
|
|
| 17 |
|
| 18 |
auth_method: str
|
| 19 |
"""The authentication method used."""
|
| 20 |
-
action:
|
| 21 |
-
control:
|
| 22 |
"""The control action taken for the detected risk."""
|
| 23 |
-
blocklist_type:
|
| 24 |
"""The type of blocklist that triggered the risk detection."""
|
| 25 |
-
ip_address:
|
| 26 |
"""The IP address of the request."""
|
| 27 |
-
user_agent:
|
| 28 |
"""The user agent of the request."""
|
| 29 |
user_id: str
|
| 30 |
"""The ID of the user."""
|
|
@@ -32,7 +34,7 @@ class AuthenticationRadarRiskDetectedData:
|
|
| 32 |
"""The email address of the user."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
-
def from_dict(cls, data:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -48,9 +50,9 @@ class AuthenticationRadarRiskDetectedData:
|
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AuthenticationRadarRiskDetectedData", e)
|
| 50 |
|
| 51 |
-
def to_dict(self) ->
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
-
result:
|
| 54 |
result["auth_method"] = self.auth_method
|
| 55 |
result["action"] = (
|
| 56 |
self.action.value if isinstance(self.action, Enum) else self.action
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .authentication_radar_risk_detected_data_action import (
|
| 12 |
AuthenticationRadarRiskDetectedDataAction,
|
| 13 |
)
|
|
|
|
| 19 |
|
| 20 |
auth_method: str
|
| 21 |
"""The authentication method used."""
|
| 22 |
+
action: AuthenticationRadarRiskDetectedDataAction
|
| 23 |
+
control: str | None
|
| 24 |
"""The control action taken for the detected risk."""
|
| 25 |
+
blocklist_type: str | None
|
| 26 |
"""The type of blocklist that triggered the risk detection."""
|
| 27 |
+
ip_address: str | None
|
| 28 |
"""The IP address of the request."""
|
| 29 |
+
user_agent: str | None
|
| 30 |
"""The user agent of the request."""
|
| 31 |
user_id: str
|
| 32 |
"""The ID of the user."""
|
|
|
|
| 34 |
"""The email address of the user."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationRadarRiskDetectedData:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("AuthenticationRadarRiskDetectedData", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["auth_method"] = self.auth_method
|
| 57 |
result["action"] = (
|
| 58 |
self.action.value if isinstance(self.action, Enum) else self.action
|
python/src/workos/common/models/authentication_radar_risk_detected_data_action.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class AuthenticationRadarRiskDetectedDataAction(str, Enum):
|
|
| 18 |
@classmethod
|
| 19 |
def _missing_(
|
| 20 |
cls, value: object
|
| 21 |
-
) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
@classmethod
|
| 18 |
def _missing_(
|
| 19 |
cls, value: object
|
| 20 |
+
) -> AuthenticationRadarRiskDetectedDataAction | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/authentication_reauthentication_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_reauthentication_succeeded_data import (
|
| 13 |
AuthenticationReauthenticationSucceededData,
|
|
@@ -24,16 +23,14 @@ class AuthenticationReauthenticationSucceeded:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["authentication.reauthentication_succeeded"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(
|
| 35 |
-
cls, data: Dict[str, Any]
|
| 36 |
-
) ->
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -41,19 +38,19 @@ class AuthenticationReauthenticationSucceeded:
|
|
| 41 |
id=data["id"],
|
| 42 |
event=data.get("event", "authentication.reauthentication_succeeded"),
|
| 43 |
data=AuthenticationReauthenticationSucceededData.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
created_at=_parse_datetime(data["created_at"]),
|
| 47 |
-
context=EventContext.from_dict(cast(
|
| 48 |
if (_v_context := data.get("context")) is not None
|
| 49 |
else None,
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationReauthenticationSucceeded", e)
|
| 53 |
|
| 54 |
-
def to_dict(self) ->
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
-
result:
|
| 57 |
result["object"] = self.object
|
| 58 |
result["id"] = self.id
|
| 59 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_reauthentication_succeeded_data import (
|
| 12 |
AuthenticationReauthenticationSucceededData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["authentication.reauthentication_succeeded"]
|
| 26 |
+
data: AuthenticationReauthenticationSucceededData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
|
|
|
|
|
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationReauthenticationSucceeded:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "authentication.reauthentication_succeeded"),
|
| 40 |
data=AuthenticationReauthenticationSucceededData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("AuthenticationReauthenticationSucceeded", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_reauthentication_succeeded_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,9 +14,9 @@ class AuthenticationReauthenticationSucceededData:
|
|
| 13 |
|
| 14 |
type: Literal["reauthentication"]
|
| 15 |
status: Literal["succeeded"]
|
| 16 |
-
ip_address:
|
| 17 |
"""The IP address of the request."""
|
| 18 |
-
user_agent:
|
| 19 |
"""The user agent of the request."""
|
| 20 |
user_id: str
|
| 21 |
"""The ID of the user."""
|
|
@@ -24,8 +25,8 @@ class AuthenticationReauthenticationSucceededData:
|
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
def from_dict(
|
| 27 |
-
cls, data:
|
| 28 |
-
) ->
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -39,9 +40,9 @@ class AuthenticationReauthenticationSucceededData:
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("AuthenticationReauthenticationSucceededData", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["type"] = self.type
|
| 46 |
result["status"] = self.status
|
| 47 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["reauthentication"]
|
| 16 |
status: Literal["succeeded"]
|
| 17 |
+
ip_address: str | None
|
| 18 |
"""The IP address of the request."""
|
| 19 |
+
user_agent: str | None
|
| 20 |
"""The user agent of the request."""
|
| 21 |
user_id: str
|
| 22 |
"""The ID of the user."""
|
|
|
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
def from_dict(
|
| 28 |
+
cls, data: dict[str, Any]
|
| 29 |
+
) -> AuthenticationReauthenticationSucceededData:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("AuthenticationReauthenticationSucceededData", e)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["type"] = self.type
|
| 47 |
result["status"] = self.status
|
| 48 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_sso_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_sso_failed_data import AuthenticationSSOFailedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationSSOFailed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.sso_failed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationSSOFailed:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.sso_failed"),
|
| 39 |
data=AuthenticationSSOFailedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationSSOFailed", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_sso_failed_data import AuthenticationSSOFailedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.sso_failed"]
|
| 24 |
+
data: AuthenticationSSOFailedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOFailed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.sso_failed"),
|
| 38 |
data=AuthenticationSSOFailedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationSSOFailed", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_sso_failed_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_failed_data_error import AuthenticationSSOFailedDataError
|
|
@@ -17,21 +17,21 @@ class AuthenticationSSOFailedData:
|
|
| 17 |
|
| 18 |
type: Literal["sso"]
|
| 19 |
status: Literal["failed"]
|
| 20 |
-
ip_address:
|
| 21 |
"""The IP address of the request."""
|
| 22 |
-
user_agent:
|
| 23 |
"""The user agent of the request."""
|
| 24 |
-
user_id:
|
| 25 |
"""The ID of the user."""
|
| 26 |
-
email:
|
| 27 |
"""The email address of the user."""
|
| 28 |
-
sso:
|
| 29 |
"""SSO connection details."""
|
| 30 |
-
error:
|
| 31 |
"""Details about the authentication error."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -42,18 +42,18 @@ class AuthenticationSSOFailedData:
|
|
| 42 |
user_id=data["user_id"],
|
| 43 |
email=data["email"],
|
| 44 |
sso=AuthenticationSSOFailedDataSSO.from_dict(
|
| 45 |
-
cast(
|
| 46 |
),
|
| 47 |
error=AuthenticationSSOFailedDataError.from_dict(
|
| 48 |
-
cast(
|
| 49 |
),
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationSSOFailedData", e)
|
| 53 |
|
| 54 |
-
def to_dict(self) ->
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
-
result:
|
| 57 |
result["type"] = self.type
|
| 58 |
result["status"] = self.status
|
| 59 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_failed_data_error import AuthenticationSSOFailedDataError
|
|
|
|
| 17 |
|
| 18 |
type: Literal["sso"]
|
| 19 |
status: Literal["failed"]
|
| 20 |
+
ip_address: str | None
|
| 21 |
"""The IP address of the request."""
|
| 22 |
+
user_agent: str | None
|
| 23 |
"""The user agent of the request."""
|
| 24 |
+
user_id: str | None
|
| 25 |
"""The ID of the user."""
|
| 26 |
+
email: str | None
|
| 27 |
"""The email address of the user."""
|
| 28 |
+
sso: AuthenticationSSOFailedDataSSO
|
| 29 |
"""SSO connection details."""
|
| 30 |
+
error: AuthenticationSSOFailedDataError
|
| 31 |
"""Details about the authentication error."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOFailedData:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
|
|
| 42 |
user_id=data["user_id"],
|
| 43 |
email=data["email"],
|
| 44 |
sso=AuthenticationSSOFailedDataSSO.from_dict(
|
| 45 |
+
cast(dict[str, Any], data["sso"])
|
| 46 |
),
|
| 47 |
error=AuthenticationSSOFailedDataError.from_dict(
|
| 48 |
+
cast(dict[str, Any], data["error"])
|
| 49 |
),
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationSSOFailedData", e)
|
| 53 |
|
| 54 |
+
def to_dict(self) -> dict[str, Any]:
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
+
result: dict[str, Any] = {}
|
| 57 |
result["type"] = self.type
|
| 58 |
result["status"] = self.status
|
| 59 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_sso_failed_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authentication_sso_failed_data_sso.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,15 +12,15 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class AuthenticationSSOFailedDataSSO:
|
| 12 |
"""SSO connection details."""
|
| 13 |
|
| 14 |
-
organization_id:
|
| 15 |
"""The ID of the organization."""
|
| 16 |
-
connection_id:
|
| 17 |
"""The ID of the SSO connection."""
|
| 18 |
-
session_id:
|
| 19 |
"""The ID of the SSO session."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class AuthenticationSSOFailedDataSSO:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("AuthenticationSSOFailedDataSSO", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
if self.organization_id is not None:
|
| 37 |
result["organization_id"] = self.organization_id
|
| 38 |
else:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class AuthenticationSSOFailedDataSSO:
|
| 13 |
"""SSO connection details."""
|
| 14 |
|
| 15 |
+
organization_id: str | None
|
| 16 |
"""The ID of the organization."""
|
| 17 |
+
connection_id: str | None
|
| 18 |
"""The ID of the SSO connection."""
|
| 19 |
+
session_id: str | None
|
| 20 |
"""The ID of the SSO session."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOFailedDataSSO:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("AuthenticationSSOFailedDataSSO", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
if self.organization_id is not None:
|
| 38 |
result["organization_id"] = self.organization_id
|
| 39 |
else:
|
python/src/workos/common/models/authentication_sso_started.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_sso_started_data import AuthenticationSSOStartedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationSSOStarted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.sso_started"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationSSOStarted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.sso_started"),
|
| 39 |
data=AuthenticationSSOStartedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationSSOStarted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_sso_started_data import AuthenticationSSOStartedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.sso_started"]
|
| 24 |
+
data: AuthenticationSSOStartedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOStarted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.sso_started"),
|
| 38 |
data=AuthenticationSSOStartedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationSSOStarted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_sso_started_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_started_data_sso import AuthenticationSSOStartedDataSSO
|
|
@@ -16,19 +16,19 @@ class AuthenticationSSOStartedData:
|
|
| 16 |
|
| 17 |
type: Literal["sso"]
|
| 18 |
status: Literal["started"]
|
| 19 |
-
ip_address:
|
| 20 |
"""The IP address of the request."""
|
| 21 |
-
user_agent:
|
| 22 |
"""The user agent of the request."""
|
| 23 |
-
user_id:
|
| 24 |
"""The ID of the user."""
|
| 25 |
-
email:
|
| 26 |
"""The email address of the user."""
|
| 27 |
-
sso:
|
| 28 |
"""SSO connection details."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -39,15 +39,15 @@ class AuthenticationSSOStartedData:
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
sso=AuthenticationSSOStartedDataSSO.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationSSOStartedData", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_started_data_sso import AuthenticationSSOStartedDataSSO
|
|
|
|
| 16 |
|
| 17 |
type: Literal["sso"]
|
| 18 |
status: Literal["started"]
|
| 19 |
+
ip_address: str | None
|
| 20 |
"""The IP address of the request."""
|
| 21 |
+
user_agent: str | None
|
| 22 |
"""The user agent of the request."""
|
| 23 |
+
user_id: str | None
|
| 24 |
"""The ID of the user."""
|
| 25 |
+
email: str | None
|
| 26 |
"""The email address of the user."""
|
| 27 |
+
sso: AuthenticationSSOStartedDataSSO
|
| 28 |
"""SSO connection details."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOStartedData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
sso=AuthenticationSSOStartedDataSSO.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["sso"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationSSOStartedData", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_sso_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_sso_succeeded_data import AuthenticationSSOSucceededData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationSSOSucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.sso_succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationSSOSucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.sso_succeeded"),
|
| 39 |
data=AuthenticationSSOSucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationSSOSucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_sso_succeeded_data import AuthenticationSSOSucceededData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.sso_succeeded"]
|
| 24 |
+
data: AuthenticationSSOSucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOSucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.sso_succeeded"),
|
| 38 |
data=AuthenticationSSOSucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationSSOSucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_sso_succeeded_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_succeeded_data_sso import AuthenticationSSOSucceededDataSSO
|
|
@@ -16,19 +16,19 @@ class AuthenticationSSOSucceededData:
|
|
| 16 |
|
| 17 |
type: Literal["sso"]
|
| 18 |
status: Literal["succeeded"]
|
| 19 |
-
ip_address:
|
| 20 |
"""The IP address of the request."""
|
| 21 |
-
user_agent:
|
| 22 |
"""The user agent of the request."""
|
| 23 |
-
user_id:
|
| 24 |
"""The ID of the user."""
|
| 25 |
email: str
|
| 26 |
"""The email address of the user."""
|
| 27 |
-
sso:
|
| 28 |
"""SSO connection details."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -39,15 +39,15 @@ class AuthenticationSSOSucceededData:
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
sso=AuthenticationSSOSucceededDataSSO.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationSSOSucceededData", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_succeeded_data_sso import AuthenticationSSOSucceededDataSSO
|
|
|
|
| 16 |
|
| 17 |
type: Literal["sso"]
|
| 18 |
status: Literal["succeeded"]
|
| 19 |
+
ip_address: str | None
|
| 20 |
"""The IP address of the request."""
|
| 21 |
+
user_agent: str | None
|
| 22 |
"""The user agent of the request."""
|
| 23 |
+
user_id: str | None
|
| 24 |
"""The ID of the user."""
|
| 25 |
email: str
|
| 26 |
"""The email address of the user."""
|
| 27 |
+
sso: AuthenticationSSOSucceededDataSSO
|
| 28 |
"""SSO connection details."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOSucceededData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 39 |
user_id=data["user_id"],
|
| 40 |
email=data["email"],
|
| 41 |
sso=AuthenticationSSOSucceededDataSSO.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["sso"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuthenticationSSOSucceededData", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["type"] = self.type
|
| 52 |
result["status"] = self.status
|
| 53 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_sso_timed_out.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .authentication_sso_timed_out_data import AuthenticationSSOTimedOutData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class AuthenticationSSOTimedOut:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["authentication.sso_timed_out"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class AuthenticationSSOTimedOut:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "authentication.sso_timed_out"),
|
| 39 |
data=AuthenticationSSOTimedOutData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("AuthenticationSSOTimedOut", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .authentication_sso_timed_out_data import AuthenticationSSOTimedOutData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["authentication.sso_timed_out"]
|
| 24 |
+
data: AuthenticationSSOTimedOutData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOTimedOut:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "authentication.sso_timed_out"),
|
| 38 |
data=AuthenticationSSOTimedOutData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("AuthenticationSSOTimedOut", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/authentication_sso_timed_out_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_timed_out_data_error import AuthenticationSSOTimedOutDataError
|
|
@@ -17,21 +17,21 @@ class AuthenticationSSOTimedOutData:
|
|
| 17 |
|
| 18 |
type: Literal["sso"]
|
| 19 |
status: Literal["timed_out"]
|
| 20 |
-
ip_address:
|
| 21 |
"""The IP address of the request."""
|
| 22 |
-
user_agent:
|
| 23 |
"""The user agent of the request."""
|
| 24 |
-
user_id:
|
| 25 |
"""The ID of the user."""
|
| 26 |
-
email:
|
| 27 |
"""The email address of the user."""
|
| 28 |
-
sso:
|
| 29 |
"""SSO connection details."""
|
| 30 |
-
error:
|
| 31 |
"""Details about the authentication error."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -42,18 +42,18 @@ class AuthenticationSSOTimedOutData:
|
|
| 42 |
user_id=data["user_id"],
|
| 43 |
email=data["email"],
|
| 44 |
sso=AuthenticationSSOTimedOutDataSSO.from_dict(
|
| 45 |
-
cast(
|
| 46 |
),
|
| 47 |
error=AuthenticationSSOTimedOutDataError.from_dict(
|
| 48 |
-
cast(
|
| 49 |
),
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationSSOTimedOutData", e)
|
| 53 |
|
| 54 |
-
def to_dict(self) ->
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
-
result:
|
| 57 |
result["type"] = self.type
|
| 58 |
result["status"] = self.status
|
| 59 |
if self.ip_address is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .authentication_sso_timed_out_data_error import AuthenticationSSOTimedOutDataError
|
|
|
|
| 17 |
|
| 18 |
type: Literal["sso"]
|
| 19 |
status: Literal["timed_out"]
|
| 20 |
+
ip_address: str | None
|
| 21 |
"""The IP address of the request."""
|
| 22 |
+
user_agent: str | None
|
| 23 |
"""The user agent of the request."""
|
| 24 |
+
user_id: str | None
|
| 25 |
"""The ID of the user."""
|
| 26 |
+
email: str | None
|
| 27 |
"""The email address of the user."""
|
| 28 |
+
sso: AuthenticationSSOTimedOutDataSSO
|
| 29 |
"""SSO connection details."""
|
| 30 |
+
error: AuthenticationSSOTimedOutDataError
|
| 31 |
"""Details about the authentication error."""
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationSSOTimedOutData:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
|
|
| 42 |
user_id=data["user_id"],
|
| 43 |
email=data["email"],
|
| 44 |
sso=AuthenticationSSOTimedOutDataSSO.from_dict(
|
| 45 |
+
cast(dict[str, Any], data["sso"])
|
| 46 |
),
|
| 47 |
error=AuthenticationSSOTimedOutDataError.from_dict(
|
| 48 |
+
cast(dict[str, Any], data["error"])
|
| 49 |
),
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("AuthenticationSSOTimedOutData", e)
|
| 53 |
|
| 54 |
+
def to_dict(self) -> dict[str, Any]:
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
+
result: dict[str, Any] = {}
|
| 57 |
result["type"] = self.type
|
| 58 |
result["status"] = self.status
|
| 59 |
if self.ip_address is not None:
|
python/src/workos/common/models/authentication_sso_timed_out_data_error.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .authentication_email_verification_failed_data_error import (
|
| 5 |
AuthenticationEmailVerificationFailedDataError,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .authentication_email_verification_failed_data_error import (
|
| 6 |
AuthenticationEmailVerificationFailedDataError,
|
| 7 |
)
|
python/src/workos/common/models/authorization_permission.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -21,7 +21,7 @@ class AuthorizationPermission:
|
|
| 21 |
"""A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks."""
|
| 22 |
name: str
|
| 23 |
"""A descriptive name for the Permission."""
|
| 24 |
-
description:
|
| 25 |
"""An optional description of the Permission."""
|
| 26 |
system: bool
|
| 27 |
"""Whether the permission is a system permission. System permissions are managed by WorkOS and cannot be deleted."""
|
|
@@ -33,7 +33,7 @@ class AuthorizationPermission:
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -50,9 +50,9 @@ class AuthorizationPermission:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("AuthorizationPermission", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["slug"] = self.slug
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 21 |
"""A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks."""
|
| 22 |
name: str
|
| 23 |
"""A descriptive name for the Permission."""
|
| 24 |
+
description: str | None
|
| 25 |
"""An optional description of the Permission."""
|
| 26 |
system: bool
|
| 27 |
"""Whether the permission is a system permission. System permissions are managed by WorkOS and cannot be deleted."""
|
|
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthorizationPermission:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("AuthorizationPermission", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["slug"] = self.slug
|
python/src/workos/common/models/connected_account.py|
@@ -39,6 +39,12 @@ class ConnectedAccount:
|
|
| 39 |
"""The authentication method used for this connection (`oauth`, `api_key`, or `client_credentials`). Defaults to `oauth` if absent."""
|
| 40 |
api_key_last_4: str | None = None
|
| 41 |
"""The last four characters of the API key, or `null` for OAuth connections."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
@classmethod
|
| 44 |
def from_dict(cls, data: dict[str, Any]) -> ConnectedAccount:
|
|
@@ -57,6 +63,9 @@ class ConnectedAccount:
|
|
| 57 |
if (_v_auth_method := data.get("auth_method")) is not None
|
| 58 |
else None,
|
| 59 |
api_key_last_4=data.get("api_key_last_4"),
|
|
|
|
|
|
|
|
|
|
| 60 |
)
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("ConnectedAccount", e)
|
|
@@ -90,4 +99,14 @@ class ConnectedAccount:
|
|
| 90 |
result["api_key_last_4"] = self.api_key_last_4
|
| 91 |
else:
|
| 92 |
result["api_key_last_4"] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
return result
|
|
|
|
| 39 |
"""The authentication method used for this connection (`oauth`, `api_key`, or `client_credentials`). Defaults to `oauth` if absent."""
|
| 40 |
api_key_last_4: str | None = None
|
| 41 |
"""The last four characters of the API key, or `null` for OAuth connections."""
|
| 42 |
+
client_id: str | None = None
|
| 43 |
+
"""The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`."""
|
| 44 |
+
client_secret_last_4: str | None = None
|
| 45 |
+
"""The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`."""
|
| 46 |
+
config: dict[str, str] | None = None
|
| 47 |
+
"""The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`."""
|
| 48 |
|
| 49 |
@classmethod
|
| 50 |
def from_dict(cls, data: dict[str, Any]) -> ConnectedAccount:
|
|
|
|
| 63 |
if (_v_auth_method := data.get("auth_method")) is not None
|
| 64 |
else None,
|
| 65 |
api_key_last_4=data.get("api_key_last_4"),
|
| 66 |
+
client_id=data.get("client_id"),
|
| 67 |
+
client_secret_last_4=data.get("client_secret_last_4"),
|
| 68 |
+
config=data.get("config"),
|
| 69 |
)
|
| 70 |
except (KeyError, ValueError) as e:
|
| 71 |
_raise_deserialize_error("ConnectedAccount", e)
|
|
|
|
| 99 |
result["api_key_last_4"] = self.api_key_last_4
|
| 100 |
else:
|
| 101 |
result["api_key_last_4"] = None
|
| 102 |
+
if self.client_id is not None:
|
| 103 |
+
result["client_id"] = self.client_id
|
| 104 |
+
else:
|
| 105 |
+
result["client_id"] = None
|
| 106 |
+
if self.client_secret_last_4 is not None:
|
| 107 |
+
result["client_secret_last_4"] = self.client_secret_last_4
|
| 108 |
+
else:
|
| 109 |
+
result["client_secret_last_4"] = None
|
| 110 |
+
if self.config is not None:
|
| 111 |
+
result["config"] = self.config
|
| 112 |
return result
|
python/src/workos/common/models/connection_activated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_activated_data import ConnectionActivatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class ConnectionActivated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["connection.activated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class ConnectionActivated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "connection.activated"),
|
| 39 |
data=ConnectionActivatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("ConnectionActivated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_activated_data import ConnectionActivatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["connection.activated"]
|
| 24 |
+
data: ConnectionActivatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionActivated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "connection.activated"),
|
| 38 |
data=ConnectionActivatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ConnectionActivated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/connection_activated_data.py|
@@ -5,15 +5,14 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
-
from .connection_activated_data_domain import ConnectionActivatedDataDomain
|
| 14 |
from .connection_activated_data_connection_type import (
|
| 15 |
ConnectionActivatedDataConnectionType,
|
| 16 |
)
|
|
|
|
| 17 |
from .connection_activated_data_state import ConnectionActivatedDataState
|
| 18 |
from .connection_activated_data_status import ConnectionActivatedDataStatus
|
| 19 |
|
|
@@ -26,11 +25,11 @@ class ConnectionActivatedData:
|
|
| 26 |
"""Distinguishes the connection object."""
|
| 27 |
id: str
|
| 28 |
"""Unique identifier of the connection."""
|
| 29 |
-
state:
|
| 30 |
"""The current state of the connection."""
|
| 31 |
name: str
|
| 32 |
"""The name of the connection."""
|
| 33 |
-
connection_type:
|
| 34 |
"""The type of the connection."""
|
| 35 |
created_at: datetime
|
| 36 |
"""An ISO 8601 timestamp."""
|
|
@@ -38,15 +37,15 @@ class ConnectionActivatedData:
|
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
external_key: str
|
| 40 |
"""The external key of the connection."""
|
| 41 |
-
status:
|
| 42 |
"""Deprecated. Use state instead."""
|
| 43 |
-
domains:
|
| 44 |
"""The domains associated with the connection."""
|
| 45 |
-
organization_id:
|
| 46 |
"""The ID of the organization the connection belongs to."""
|
| 47 |
|
| 48 |
@classmethod
|
| 49 |
-
def from_dict(cls, data:
|
| 50 |
"""Deserialize from a dictionary."""
|
| 51 |
try:
|
| 52 |
return cls(
|
|
@@ -62,7 +61,7 @@ class ConnectionActivatedData:
|
|
| 62 |
external_key=data["external_key"],
|
| 63 |
status=ConnectionActivatedDataStatus(data["status"]),
|
| 64 |
domains=[
|
| 65 |
-
ConnectionActivatedDataDomain.from_dict(cast(
|
| 66 |
for item in cast(list[Any], data["domains"])
|
| 67 |
],
|
| 68 |
organization_id=data.get("organization_id"),
|
|
@@ -70,9 +69,9 @@ class ConnectionActivatedData:
|
|
| 70 |
except (KeyError, ValueError) as e:
|
| 71 |
_raise_deserialize_error("ConnectionActivatedData", e)
|
| 72 |
|
| 73 |
-
def to_dict(self) ->
|
| 74 |
"""Serialize to a dictionary."""
|
| 75 |
-
result:
|
| 76 |
result["object"] = self.object
|
| 77 |
result["id"] = self.id
|
| 78 |
result["state"] = (
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
|
|
|
| 12 |
from .connection_activated_data_connection_type import (
|
| 13 |
ConnectionActivatedDataConnectionType,
|
| 14 |
)
|
| 15 |
+
from .connection_activated_data_domain import ConnectionActivatedDataDomain
|
| 16 |
from .connection_activated_data_state import ConnectionActivatedDataState
|
| 17 |
from .connection_activated_data_status import ConnectionActivatedDataStatus
|
| 18 |
|
|
|
|
| 25 |
"""Distinguishes the connection object."""
|
| 26 |
id: str
|
| 27 |
"""Unique identifier of the connection."""
|
| 28 |
+
state: ConnectionActivatedDataState
|
| 29 |
"""The current state of the connection."""
|
| 30 |
name: str
|
| 31 |
"""The name of the connection."""
|
| 32 |
+
connection_type: ConnectionActivatedDataConnectionType
|
| 33 |
"""The type of the connection."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
external_key: str
|
| 39 |
"""The external key of the connection."""
|
| 40 |
+
status: ConnectionActivatedDataStatus
|
| 41 |
"""Deprecated. Use state instead."""
|
| 42 |
+
domains: list[ConnectionActivatedDataDomain]
|
| 43 |
"""The domains associated with the connection."""
|
| 44 |
+
organization_id: str | None = None
|
| 45 |
"""The ID of the organization the connection belongs to."""
|
| 46 |
|
| 47 |
@classmethod
|
| 48 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionActivatedData:
|
| 49 |
"""Deserialize from a dictionary."""
|
| 50 |
try:
|
| 51 |
return cls(
|
|
|
|
| 61 |
external_key=data["external_key"],
|
| 62 |
status=ConnectionActivatedDataStatus(data["status"]),
|
| 63 |
domains=[
|
| 64 |
+
ConnectionActivatedDataDomain.from_dict(cast(dict[str, Any], item))
|
| 65 |
for item in cast(list[Any], data["domains"])
|
| 66 |
],
|
| 67 |
organization_id=data.get("organization_id"),
|
|
|
|
| 69 |
except (KeyError, ValueError) as e:
|
| 70 |
_raise_deserialize_error("ConnectionActivatedData", e)
|
| 71 |
|
| 72 |
+
def to_dict(self) -> dict[str, Any]:
|
| 73 |
"""Serialize to a dictionary."""
|
| 74 |
+
result: dict[str, Any] = {}
|
| 75 |
result["object"] = self.object
|
| 76 |
result["id"] = self.id
|
| 77 |
result["state"] = (
|
python/src/workos/common/models/connection_activated_data_connection_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -34,6 +33,8 @@ class ConnectionActivatedDataConnectionType(str, Enum):
|
|
| 34 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 35 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 36 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 37 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 38 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 39 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -64,9 +65,7 @@ class ConnectionActivatedDataConnectionType(str, Enum):
|
|
| 64 |
XERO_OAUTH = "XeroOAuth"
|
| 65 |
|
| 66 |
@classmethod
|
| 67 |
-
def _missing_(
|
| 68 |
-
cls, value: object
|
| 69 |
-
) ->
|
| 70 |
if not isinstance(value, str):
|
| 71 |
return None
|
| 72 |
unknown = str.__new__(cls, value)
|
|
@@ -98,6 +97,8 @@ ConnectionActivatedDataConnectionTypeLiteral: TypeAlias = Literal[
|
|
| 98 |
"GoogleOAuth",
|
| 99 |
"GoogleOIDC",
|
| 100 |
"GoogleSAML",
|
|
|
|
|
|
|
| 101 |
"IntuitOAuth",
|
| 102 |
"JumpCloudSAML",
|
| 103 |
"KeycloakSAML",
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 33 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 34 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 35 |
GOOGLE_SAML = "GoogleSAML"
|
| 36 |
+
GROK_OAUTH = "GrokOAuth"
|
| 37 |
+
XO_AUTH = "XOAuth"
|
| 38 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 39 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 40 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 65 |
XERO_OAUTH = "XeroOAuth"
|
| 66 |
|
| 67 |
@classmethod
|
|
|
|
|
|
|
| 68 |
+
def _missing_(cls, value: object) -> ConnectionActivatedDataConnectionType | None:
|
| 69 |
if not isinstance(value, str):
|
| 70 |
return None
|
| 71 |
unknown = str.__new__(cls, value)
|
|
|
|
| 97 |
"GoogleOAuth",
|
| 98 |
"GoogleOIDC",
|
| 99 |
"GoogleSAML",
|
| 100 |
+
"GrokOAuth",
|
| 101 |
+
"XOAuth",
|
| 102 |
"IntuitOAuth",
|
| 103 |
"JumpCloudSAML",
|
| 104 |
"KeycloakSAML",
|
python/src/workos/common/models/connection_activated_data_domain.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,7 +20,7 @@ class ConnectionActivatedDataDomain:
|
|
| 19 |
"""The domain value."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class ConnectionActivatedDataDomain:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("ConnectionActivatedDataDomain", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["object"] = self.object
|
| 37 |
result["id"] = self.id
|
| 38 |
result["domain"] = self.domain
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The domain value."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionActivatedDataDomain:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("ConnectionActivatedDataDomain", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["object"] = self.object
|
| 38 |
result["id"] = self.id
|
| 39 |
result["domain"] = self.domain
|
python/src/workos/common/models/connection_activated_data_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,7 +18,7 @@ class ConnectionActivatedDataState(str, Enum):
|
|
| 19 |
DELETING = "deleting"
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def _missing_(cls, value: object) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
DELETING = "deleting"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def _missing_(cls, value: object) -> ConnectionActivatedDataState | None:
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/connection_activated_data_status.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class ConnectionActivatedDataStatus(str, Enum):
|
|
| 16 |
UNLINKED = "unlinked"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
UNLINKED = "unlinked"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> ConnectionActivatedDataStatus | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/connection_deactivated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_deactivated_data import ConnectionDeactivatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class ConnectionDeactivated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["connection.deactivated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class ConnectionDeactivated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "connection.deactivated"),
|
| 39 |
data=ConnectionDeactivatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("ConnectionDeactivated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_deactivated_data import ConnectionDeactivatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["connection.deactivated"]
|
| 24 |
+
data: ConnectionDeactivatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionDeactivated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "connection.deactivated"),
|
| 38 |
data=ConnectionDeactivatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ConnectionDeactivated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/connection_deactivated_data_connection_type.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .connection_activated_data_connection_type import (
|
| 5 |
ConnectionActivatedDataConnectionType,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .connection_activated_data_connection_type import (
|
| 6 |
ConnectionActivatedDataConnectionType,
|
| 7 |
)
|
python/src/workos/common/models/connection_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_deleted_data import ConnectionDeletedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class ConnectionDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["connection.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class ConnectionDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "connection.deleted"),
|
| 39 |
data=ConnectionDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("ConnectionDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_deleted_data import ConnectionDeletedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["connection.deleted"]
|
| 24 |
+
data: ConnectionDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "connection.deleted"),
|
| 38 |
data=ConnectionDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("ConnectionDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/connection_deleted_data.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .connection_deleted_data_connection_type import ConnectionDeletedDataConnectionType
|
| 12 |
from .connection_deleted_data_state import ConnectionDeletedDataState
|
| 13 |
|
|
@@ -20,21 +21,21 @@ class ConnectionDeletedData:
|
|
| 20 |
"""Distinguishes the connection object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the connection."""
|
| 23 |
-
state:
|
| 24 |
"""The current state of the connection."""
|
| 25 |
name: str
|
| 26 |
"""The name of the connection."""
|
| 27 |
-
connection_type:
|
| 28 |
"""The type of the connection."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
updated_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
-
organization_id:
|
| 34 |
"""The ID of the organization the connection belongs to."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
@@ -52,9 +53,9 @@ class ConnectionDeletedData:
|
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("ConnectionDeletedData", e)
|
| 54 |
|
| 55 |
-
def to_dict(self) ->
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
-
result:
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["state"] = (
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .connection_deleted_data_connection_type import ConnectionDeletedDataConnectionType
|
| 13 |
from .connection_deleted_data_state import ConnectionDeletedDataState
|
| 14 |
|
|
|
|
| 21 |
"""Distinguishes the connection object."""
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the connection."""
|
| 24 |
+
state: ConnectionDeletedDataState
|
| 25 |
"""The current state of the connection."""
|
| 26 |
name: str
|
| 27 |
"""The name of the connection."""
|
| 28 |
+
connection_type: ConnectionDeletedDataConnectionType
|
| 29 |
"""The type of the connection."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
updated_at: datetime
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
+
organization_id: str | None = None
|
| 35 |
"""The ID of the organization the connection belongs to."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionDeletedData:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
|
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("ConnectionDeletedData", e)
|
| 55 |
|
| 56 |
+
def to_dict(self) -> dict[str, Any]:
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
+
result: dict[str, Any] = {}
|
| 59 |
result["object"] = self.object
|
| 60 |
result["id"] = self.id
|
| 61 |
result["state"] = (
|
python/src/workos/common/models/connection_deleted_data_connection_type.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .connection_activated_data_connection_type import (
|
| 5 |
ConnectionActivatedDataConnectionType,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .connection_activated_data_connection_type import (
|
| 6 |
ConnectionActivatedDataConnectionType,
|
| 7 |
)
|
python/src/workos/common/models/connection_saml_certificate_renewal_required.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_saml_certificate_renewal_required_data import (
|
| 13 |
ConnectionSAMLCertificateRenewalRequiredData,
|
|
@@ -24,16 +23,16 @@ class ConnectionSAMLCertificateRenewalRequired:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["connection.saml_certificate_renewal_required"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
def from_dict(
|
| 35 |
-
cls, data:
|
| 36 |
-
) ->
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -41,19 +40,19 @@ class ConnectionSAMLCertificateRenewalRequired:
|
|
| 41 |
id=data["id"],
|
| 42 |
event=data.get("event", "connection.saml_certificate_renewal_required"),
|
| 43 |
data=ConnectionSAMLCertificateRenewalRequiredData.from_dict(
|
| 44 |
-
cast(
|
| 45 |
),
|
| 46 |
created_at=_parse_datetime(data["created_at"]),
|
| 47 |
-
context=EventContext.from_dict(cast(
|
| 48 |
if (_v_context := data.get("context")) is not None
|
| 49 |
else None,
|
| 50 |
)
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewalRequired", e)
|
| 53 |
|
| 54 |
-
def to_dict(self) ->
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
-
result:
|
| 57 |
result["object"] = self.object
|
| 58 |
result["id"] = self.id
|
| 59 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_saml_certificate_renewal_required_data import (
|
| 12 |
ConnectionSAMLCertificateRenewalRequiredData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["connection.saml_certificate_renewal_required"]
|
| 26 |
+
data: ConnectionSAMLCertificateRenewalRequiredData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
+
cls, data: dict[str, Any]
|
| 35 |
+
) -> ConnectionSAMLCertificateRenewalRequired:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 40 |
id=data["id"],
|
| 41 |
event=data.get("event", "connection.saml_certificate_renewal_required"),
|
| 42 |
data=ConnectionSAMLCertificateRenewalRequiredData.from_dict(
|
| 43 |
+
cast(dict[str, Any], data["data"])
|
| 44 |
),
|
| 45 |
created_at=_parse_datetime(data["created_at"]),
|
| 46 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 47 |
if (_v_context := data.get("context")) is not None
|
| 48 |
else None,
|
| 49 |
)
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewalRequired", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["event"] = self.event
|
python/src/workos/common/models/connection_saml_certificate_renewal_required_data.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .connection_saml_certificate_renewal_required_data_certificate import (
|
|
@@ -19,34 +19,34 @@ from .connection_saml_certificate_renewal_required_data_connection import (
|
|
| 19 |
class ConnectionSAMLCertificateRenewalRequiredData:
|
| 20 |
"""The event payload."""
|
| 21 |
|
| 22 |
-
connection:
|
| 23 |
"""The connection with the expiring certificate."""
|
| 24 |
-
certificate:
|
| 25 |
"""The SAML certificate details."""
|
| 26 |
days_until_expiry: int
|
| 27 |
"""The number of days until the certificate expires."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
def from_dict(
|
| 31 |
-
cls, data:
|
| 32 |
-
) ->
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
connection=ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
|
| 37 |
-
cast(
|
| 38 |
),
|
| 39 |
certificate=ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
days_until_expiry=data["days_until_expiry"],
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewalRequiredData", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["connection"] = self.connection.to_dict()
|
| 51 |
result["certificate"] = self.certificate.to_dict()
|
| 52 |
result["days_until_expiry"] = self.days_until_expiry
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .connection_saml_certificate_renewal_required_data_certificate import (
|
|
|
|
| 19 |
class ConnectionSAMLCertificateRenewalRequiredData:
|
| 20 |
"""The event payload."""
|
| 21 |
|
| 22 |
+
connection: ConnectionSAMLCertificateRenewalRequiredDataConnection
|
| 23 |
"""The connection with the expiring certificate."""
|
| 24 |
+
certificate: ConnectionSAMLCertificateRenewalRequiredDataCertificate
|
| 25 |
"""The SAML certificate details."""
|
| 26 |
days_until_expiry: int
|
| 27 |
"""The number of days until the certificate expires."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
def from_dict(
|
| 31 |
+
cls, data: dict[str, Any]
|
| 32 |
+
) -> ConnectionSAMLCertificateRenewalRequiredData:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
connection=ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(
|
| 37 |
+
cast(dict[str, Any], data["connection"])
|
| 38 |
),
|
| 39 |
certificate=ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(
|
| 40 |
+
cast(dict[str, Any], data["certificate"])
|
| 41 |
),
|
| 42 |
days_until_expiry=data["days_until_expiry"],
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewalRequiredData", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["connection"] = self.connection.to_dict()
|
| 51 |
result["certificate"] = self.certificate.to_dict()
|
| 52 |
result["days_until_expiry"] = self.days_until_expiry
|
python/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import (
|
| 12 |
ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType,
|
| 13 |
)
|
|
@@ -18,7 +19,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificate:
|
|
| 18 |
"""The SAML certificate details."""
|
| 19 |
|
| 20 |
certificate_type: (
|
| 21 |
-
|
| 22 |
)
|
| 23 |
"""The type of the SAML certificate."""
|
| 24 |
expiry_date: datetime
|
|
@@ -28,8 +29,8 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificate:
|
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
def from_dict(
|
| 31 |
-
cls, data:
|
| 32 |
-
) ->
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -44,9 +45,9 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificate:
|
|
| 44 |
"ConnectionSAMLCertificateRenewalRequiredDataCertificate", e
|
| 45 |
)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["certificate_type"] = (
|
| 51 |
self.certificate_type.value
|
| 52 |
if isinstance(self.certificate_type, Enum)
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import (
|
| 13 |
ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType,
|
| 14 |
)
|
|
|
|
| 19 |
"""The SAML certificate details."""
|
| 20 |
|
| 21 |
certificate_type: (
|
| 22 |
+
ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType
|
| 23 |
)
|
| 24 |
"""The type of the SAML certificate."""
|
| 25 |
expiry_date: datetime
|
|
|
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
def from_dict(
|
| 32 |
+
cls, data: dict[str, Any]
|
| 33 |
+
) -> ConnectionSAMLCertificateRenewalRequiredDataCertificate:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 45 |
"ConnectionSAMLCertificateRenewalRequiredDataCertificate", e
|
| 46 |
)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["certificate_type"] = (
|
| 52 |
self.certificate_type.value
|
| 53 |
if isinstance(self.certificate_type, Enum)
|
python/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate_certificate_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,9 +18,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType(str
|
|
| 19 |
@classmethod
|
| 20 |
def _missing_(
|
| 21 |
cls, value: object
|
| 22 |
-
) -> Optional[
|
| 23 |
-
|
| 24 |
-
]:
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
@classmethod
|
| 19 |
def _missing_(
|
| 20 |
cls, value: object
|
|
|
|
| 21 |
+
) -> ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType | None:
|
|
|
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/connection_saml_certificate_renewal_required_data_connection.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,13 +14,13 @@ class ConnectionSAMLCertificateRenewalRequiredDataConnection:
|
|
| 13 |
|
| 14 |
id: str
|
| 15 |
"""Unique identifier of the connection."""
|
| 16 |
-
organization_id:
|
| 17 |
"""The ID of the organization the connection belongs to."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -31,9 +32,9 @@ class ConnectionSAMLCertificateRenewalRequiredDataConnection:
|
|
| 31 |
"ConnectionSAMLCertificateRenewalRequiredDataConnection", e
|
| 32 |
)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["id"] = self.id
|
| 38 |
if self.organization_id is not None:
|
| 39 |
result["organization_id"] = self.organization_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
id: str
|
| 16 |
"""Unique identifier of the connection."""
|
| 17 |
+
organization_id: str | None = None
|
| 18 |
"""The ID of the organization the connection belongs to."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> ConnectionSAMLCertificateRenewalRequiredDataConnection:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 32 |
"ConnectionSAMLCertificateRenewalRequiredDataConnection", e
|
| 33 |
)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["id"] = self.id
|
| 39 |
if self.organization_id is not None:
|
| 40 |
result["organization_id"] = self.organization_id
|
python/src/workos/common/models/connection_saml_certificate_renewed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_saml_certificate_renewed_data import (
|
| 13 |
ConnectionSAMLCertificateRenewedData,
|
|
@@ -24,14 +23,14 @@ class ConnectionSAMLCertificateRenewed:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["connection.saml_certificate_renewed"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class ConnectionSAMLCertificateRenewed:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "connection.saml_certificate_renewed"),
|
| 41 |
data=ConnectionSAMLCertificateRenewedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewed", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_saml_certificate_renewed_data import (
|
| 12 |
ConnectionSAMLCertificateRenewedData,
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["connection.saml_certificate_renewed"]
|
| 26 |
+
data: ConnectionSAMLCertificateRenewedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionSAMLCertificateRenewed:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "connection.saml_certificate_renewed"),
|
| 40 |
data=ConnectionSAMLCertificateRenewedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewed", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/connection_saml_certificate_renewed_data.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .connection_saml_certificate_renewed_data_certificate import (
|
| 13 |
ConnectionSAMLCertificateRenewedDataCertificate,
|
|
@@ -21,32 +20,32 @@ from .connection_saml_certificate_renewed_data_connection import (
|
|
| 21 |
class ConnectionSAMLCertificateRenewedData:
|
| 22 |
"""The event payload."""
|
| 23 |
|
| 24 |
-
connection:
|
| 25 |
"""The connection with the renewed certificate."""
|
| 26 |
-
certificate:
|
| 27 |
"""The renewed SAML certificate details."""
|
| 28 |
renewed_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
connection=ConnectionSAMLCertificateRenewedDataConnection.from_dict(
|
| 37 |
-
cast(
|
| 38 |
),
|
| 39 |
certificate=ConnectionSAMLCertificateRenewedDataCertificate.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
renewed_at=_parse_datetime(data["renewed_at"]),
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewedData", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["connection"] = self.connection.to_dict()
|
| 51 |
result["certificate"] = self.certificate.to_dict()
|
| 52 |
result["renewed_at"] = _format_datetime(self.renewed_at)
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .connection_saml_certificate_renewed_data_certificate import (
|
| 12 |
ConnectionSAMLCertificateRenewedDataCertificate,
|
|
|
|
| 20 |
class ConnectionSAMLCertificateRenewedData:
|
| 21 |
"""The event payload."""
|
| 22 |
|
| 23 |
+
connection: ConnectionSAMLCertificateRenewedDataConnection
|
| 24 |
"""The connection with the renewed certificate."""
|
| 25 |
+
certificate: ConnectionSAMLCertificateRenewedDataCertificate
|
| 26 |
"""The renewed SAML certificate details."""
|
| 27 |
renewed_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> ConnectionSAMLCertificateRenewedData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
connection=ConnectionSAMLCertificateRenewedDataConnection.from_dict(
|
| 36 |
+
cast(dict[str, Any], data["connection"])
|
| 37 |
),
|
| 38 |
certificate=ConnectionSAMLCertificateRenewedDataCertificate.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["certificate"])
|
| 40 |
),
|
| 41 |
renewed_at=_parse_datetime(data["renewed_at"]),
|
| 42 |
)
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("ConnectionSAMLCertificateRenewedData", e)
|
| 45 |
|
| 46 |
+
def to_dict(self) -> dict[str, Any]:
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
+
result: dict[str, Any] = {}
|
| 49 |
result["connection"] = self.connection.to_dict()
|
| 50 |
result["certificate"] = self.certificate.to_dict()
|
| 51 |
result["renewed_at"] = _format_datetime(self.renewed_at)
|
python/src/workos/common/models/connection_saml_certificate_renewed_data_certificate.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .connection_saml_certificate_renewed_data_certificate_certificate_type import (
|
| 12 |
ConnectionSAMLCertificateRenewedDataCertificateCertificateType,
|
| 13 |
)
|
|
@@ -17,15 +18,15 @@ from .connection_saml_certificate_renewed_data_certificate_certificate_type impo
|
|
| 17 |
class ConnectionSAMLCertificateRenewedDataCertificate:
|
| 18 |
"""The renewed SAML certificate details."""
|
| 19 |
|
| 20 |
-
certificate_type:
|
| 21 |
"""The type of the SAML certificate."""
|
| 22 |
expiry_date: datetime
|
| 23 |
"""An ISO 8601 timestamp."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
def from_dict(
|
| 27 |
-
cls, data:
|
| 28 |
-
) ->
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -39,9 +40,9 @@ class ConnectionSAMLCertificateRenewedDataCertificate:
|
|
| 39 |
"ConnectionSAMLCertificateRenewedDataCertificate", e
|
| 40 |
)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["certificate_type"] = (
|
| 46 |
self.certificate_type.value
|
| 47 |
if isinstance(self.certificate_type, Enum)
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .connection_saml_certificate_renewed_data_certificate_certificate_type import (
|
| 13 |
ConnectionSAMLCertificateRenewedDataCertificateCertificateType,
|
| 14 |
)
|
|
|
|
| 18 |
class ConnectionSAMLCertificateRenewedDataCertificate:
|
| 19 |
"""The renewed SAML certificate details."""
|
| 20 |
|
| 21 |
+
certificate_type: ConnectionSAMLCertificateRenewedDataCertificateCertificateType
|
| 22 |
"""The type of the SAML certificate."""
|
| 23 |
expiry_date: datetime
|
| 24 |
"""An ISO 8601 timestamp."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
def from_dict(
|
| 28 |
+
cls, data: dict[str, Any]
|
| 29 |
+
) -> ConnectionSAMLCertificateRenewedDataCertificate:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 40 |
"ConnectionSAMLCertificateRenewedDataCertificate", e
|
| 41 |
)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["certificate_type"] = (
|
| 47 |
self.certificate_type.value
|
| 48 |
if isinstance(self.certificate_type, Enum)
|
python/src/workos/common/models/connection_saml_certificate_renewed_data_certificate_certificate_type.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import (
|
| 5 |
ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import (
|
| 6 |
ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType,
|
| 7 |
)
|
python/src/workos/common/models/connection_saml_certificate_renewed_data_connection.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .connection_saml_certificate_renewal_required_data_connection import (
|
| 5 |
ConnectionSAMLCertificateRenewalRequiredDataConnection,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .connection_saml_certificate_renewal_required_data_connection import (
|
| 6 |
ConnectionSAMLCertificateRenewalRequiredDataConnection,
|
| 7 |
)
|
python/src/workos/common/models/connection_type.py|
@@ -34,6 +34,8 @@ class ConnectionType(str, Enum):
|
|
| 34 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 35 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 36 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 37 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 38 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 39 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -97,6 +99,8 @@ ConnectionTypeLiteral: TypeAlias = Literal[
|
|
| 97 |
"GoogleOAuth",
|
| 98 |
"GoogleOIDC",
|
| 99 |
"GoogleSAML",
|
|
|
|
|
|
|
| 100 |
"IntuitOAuth",
|
| 101 |
"JumpCloudSAML",
|
| 102 |
"KeycloakSAML",
|
|
|
|
| 34 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 35 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 36 |
GOOGLE_SAML = "GoogleSAML"
|
| 37 |
+
GROK_OAUTH = "GrokOAuth"
|
| 38 |
+
XO_AUTH = "XOAuth"
|
| 39 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 40 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 41 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 99 |
"GoogleOAuth",
|
| 100 |
"GoogleOIDC",
|
| 101 |
"GoogleSAML",
|
| 102 |
+
"GrokOAuth",
|
| 103 |
+
"XOAuth",
|
| 104 |
"IntuitOAuth",
|
| 105 |
"JumpCloudSAML",
|
| 106 |
"KeycloakSAML",
|
python/src/workos/common/models/create_data_integration_auth_methods.py|
@@ -1,27 +1,8 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
from
|
| 6 |
|
| 7 |
-
from enum import Enum
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
"""Known values for CreateDataIntegrationAuthMethods."""
|
| 13 |
-
|
| 14 |
-
OAUTH = "oauth"
|
| 15 |
-
API_KEY = "api_key"
|
| 16 |
-
|
| 17 |
-
@classmethod
|
| 18 |
-
def _missing_(cls, value: object) -> CreateDataIntegrationAuthMethods | None:
|
| 19 |
-
if not isinstance(value, str):
|
| 20 |
-
return None
|
| 21 |
-
unknown = str.__new__(cls, value)
|
| 22 |
-
unknown._name_ = value.upper()
|
| 23 |
-
unknown._value_ = value
|
| 24 |
-
return unknown
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
CreateDataIntegrationAuthMethodsLiteral: TypeAlias = Literal["oauth", "api_key"]
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
+
from typing import TypeAlias
|
| 4 |
|
| 5 |
+
from .connected_account_auth_method import ConnectedAccountAuthMethod
|
| 6 |
|
|
|
|
| 7 |
+
CreateDataIntegrationAuthMethods: TypeAlias = ConnectedAccountAuthMethod
|
|
|
|
|
|
|
| 8 |
+
__all__ = ["CreateDataIntegrationAuthMethods"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
python/src/workos/common/models/create_webhook_endpoint_events.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,6 +18,7 @@ class CreateWebhookEndpointEvents(str, Enum):
|
|
| 19 |
AGENT_REGISTRATION_CLAIM_COMPLETED = "agent.registration.claim.completed"
|
| 20 |
AGENT_REGISTRATION_CREDENTIAL_ISSUED = "agent.registration.credential.issued"
|
| 21 |
AGENT_REGISTRATION_DELETED = "agent.registration.deleted"
|
|
|
|
| 22 |
AGENT_REGISTRATION_EXPIRED = "agent.registration.expired"
|
| 23 |
AGENT_REGISTRATION_ORGANIZATION_SWITCHED = (
|
| 24 |
"agent.registration.organization.switched"
|
|
@@ -120,7 +120,7 @@ class CreateWebhookEndpointEvents(str, Enum):
|
|
| 120 |
WAITLIST_USER_DENIED = "waitlist_user.denied"
|
| 121 |
|
| 122 |
@classmethod
|
| 123 |
-
def _missing_(cls, value: object) ->
|
| 124 |
if not isinstance(value, str):
|
| 125 |
return None
|
| 126 |
unknown = str.__new__(cls, value)
|
|
@@ -135,6 +135,7 @@ CreateWebhookEndpointEventsLiteral: TypeAlias = Literal[
|
|
| 135 |
"agent.registration.claim.completed",
|
| 136 |
"agent.registration.credential.issued",
|
| 137 |
"agent.registration.deleted",
|
|
|
|
| 138 |
"agent.registration.expired",
|
| 139 |
"agent.registration.organization.switched",
|
| 140 |
"agent.registration.revoked",
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
AGENT_REGISTRATION_CLAIM_COMPLETED = "agent.registration.claim.completed"
|
| 19 |
AGENT_REGISTRATION_CREDENTIAL_ISSUED = "agent.registration.credential.issued"
|
| 20 |
AGENT_REGISTRATION_DELETED = "agent.registration.deleted"
|
| 21 |
+
AGENT_REGISTRATION_REFRESHED = "agent.registration.refreshed"
|
| 22 |
AGENT_REGISTRATION_EXPIRED = "agent.registration.expired"
|
| 23 |
AGENT_REGISTRATION_ORGANIZATION_SWITCHED = (
|
| 24 |
"agent.registration.organization.switched"
|
|
|
|
| 120 |
WAITLIST_USER_DENIED = "waitlist_user.denied"
|
| 121 |
|
| 122 |
@classmethod
|
| 123 |
+
def _missing_(cls, value: object) -> CreateWebhookEndpointEvents | None:
|
| 124 |
if not isinstance(value, str):
|
| 125 |
return None
|
| 126 |
unknown = str.__new__(cls, value)
|
|
|
|
| 135 |
"agent.registration.claim.completed",
|
| 136 |
"agent.registration.credential.issued",
|
| 137 |
"agent.registration.deleted",
|
| 138 |
+
"agent.registration.refreshed",
|
| 139 |
"agent.registration.expired",
|
| 140 |
"agent.registration.organization.switched",
|
| 141 |
"agent.registration.revoked",
|
python/src/workos/common/models/directory_group.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -29,11 +29,11 @@ class DirectoryGroup:
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
-
raw_attributes:
|
| 33 |
"""The raw attributes received from the directory provider."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -50,9 +50,9 @@ class DirectoryGroup:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("DirectoryGroup", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["idp_id"] = self.idp_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
+
raw_attributes: dict[str, Any] | None = None
|
| 33 |
"""The raw attributes received from the directory provider."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryGroup:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("DirectoryGroup", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["idp_id"] = self.idp_id
|
python/src/workos/common/models/directory_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,7 +18,7 @@ class DirectoryState(str, Enum):
|
|
| 19 |
DELETING = "deleting"
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def _missing_(cls, value: object) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
DELETING = "deleting"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def _missing_(cls, value: object) -> DirectoryState | None:
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/directory_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -35,7 +34,7 @@ class DirectoryType(str, Enum):
|
|
| 35 |
WORKDAY = "workday"
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
-
def _missing_(cls, value: object) ->
|
| 39 |
if not isinstance(value, str):
|
| 40 |
return None
|
| 41 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 34 |
WORKDAY = "workday"
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def _missing_(cls, value: object) -> DirectoryType | None:
|
| 38 |
if not isinstance(value, str):
|
| 39 |
return None
|
| 40 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/directory_user.py|
@@ -5,14 +5,13 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .directory_user_email import DirectoryUserEmail
|
| 14 |
-
from .slim_role import SlimRole
|
| 15 |
from .directory_user_state import DirectoryUserState
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
|
@@ -29,44 +28,44 @@ class DirectoryUser:
|
|
| 29 |
"""The identifier for the Organization in which the Directory resides."""
|
| 30 |
idp_id: str
|
| 31 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 32 |
-
email:
|
| 33 |
"""The email address of the user."""
|
| 34 |
-
state:
|
| 35 |
"""The state of the user."""
|
| 36 |
-
custom_attributes:
|
| 37 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 38 |
created_at: datetime
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
updated_at: datetime
|
| 41 |
"""An ISO 8601 timestamp."""
|
| 42 |
-
first_name:
|
| 43 |
"""The first name of the user."""
|
| 44 |
-
last_name:
|
| 45 |
"""The last name of the user."""
|
| 46 |
-
name:
|
| 47 |
"""The full name of the user."""
|
| 48 |
-
emails:
|
| 49 |
"""A list of email addresses for the user.
|
| 50 |
|
| 51 |
.. deprecated:: This field is deprecated."""
|
| 52 |
-
job_title:
|
| 53 |
"""The job title of the user.
|
| 54 |
|
| 55 |
.. deprecated:: This field is deprecated."""
|
| 56 |
-
username:
|
| 57 |
"""The username of the user.
|
| 58 |
|
| 59 |
.. deprecated:: This field is deprecated."""
|
| 60 |
-
raw_attributes:
|
| 61 |
"""The raw attributes received from the directory provider.
|
| 62 |
|
| 63 |
.. deprecated:: This field is deprecated."""
|
| 64 |
-
role:
|
| 65 |
-
roles:
|
| 66 |
"""All roles assigned to the user."""
|
| 67 |
|
| 68 |
@classmethod
|
| 69 |
-
def from_dict(cls, data:
|
| 70 |
"""Deserialize from a dictionary."""
|
| 71 |
try:
|
| 72 |
return cls(
|
|
@@ -84,7 +83,7 @@ class DirectoryUser:
|
|
| 84 |
last_name=data.get("last_name"),
|
| 85 |
name=data.get("name"),
|
| 86 |
emails=[
|
| 87 |
-
DirectoryUserEmail.from_dict(cast(
|
| 88 |
for item in cast(list[Any], _v_emails)
|
| 89 |
]
|
| 90 |
if (_v_emails := data.get("emails")) is not None
|
|
@@ -92,11 +91,11 @@ class DirectoryUser:
|
|
| 92 |
job_title=data.get("job_title"),
|
| 93 |
username=data.get("username"),
|
| 94 |
raw_attributes=data.get("raw_attributes"),
|
| 95 |
-
role=SlimRole.from_dict(cast(
|
| 96 |
if (_v_role := data.get("role")) is not None
|
| 97 |
else None,
|
| 98 |
roles=[
|
| 99 |
-
SlimRole.from_dict(cast(
|
| 100 |
for item in cast(list[Any], _v_roles)
|
| 101 |
]
|
| 102 |
if (_v_roles := data.get("roles")) is not None
|
|
@@ -105,9 +104,9 @@ class DirectoryUser:
|
|
| 105 |
except (KeyError, ValueError) as e:
|
| 106 |
_raise_deserialize_error("DirectoryUser", e)
|
| 107 |
|
| 108 |
-
def to_dict(self) ->
|
| 109 |
"""Serialize to a dictionary."""
|
| 110 |
-
result:
|
| 111 |
result["object"] = self.object
|
| 112 |
result["id"] = self.id
|
| 113 |
result["directory_id"] = self.directory_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .directory_user_email import DirectoryUserEmail
|
|
|
|
| 13 |
from .directory_user_state import DirectoryUserState
|
| 14 |
+
from .slim_role import SlimRole
|
| 15 |
|
| 16 |
|
| 17 |
@dataclass(slots=True)
|
|
|
|
| 28 |
"""The identifier for the Organization in which the Directory resides."""
|
| 29 |
idp_id: str
|
| 30 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 31 |
+
email: str | None
|
| 32 |
"""The email address of the user."""
|
| 33 |
+
state: DirectoryUserState
|
| 34 |
"""The state of the user."""
|
| 35 |
+
custom_attributes: dict[str, Any]
|
| 36 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 37 |
created_at: datetime
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
updated_at: datetime
|
| 40 |
"""An ISO 8601 timestamp."""
|
| 41 |
+
first_name: str | None = None
|
| 42 |
"""The first name of the user."""
|
| 43 |
+
last_name: str | None = None
|
| 44 |
"""The last name of the user."""
|
| 45 |
+
name: str | None = None
|
| 46 |
"""The full name of the user."""
|
| 47 |
+
emails: list[DirectoryUserEmail] | None = None
|
| 48 |
"""A list of email addresses for the user.
|
| 49 |
|
| 50 |
.. deprecated:: This field is deprecated."""
|
| 51 |
+
job_title: str | None = None
|
| 52 |
"""The job title of the user.
|
| 53 |
|
| 54 |
.. deprecated:: This field is deprecated."""
|
| 55 |
+
username: str | None = None
|
| 56 |
"""The username of the user.
|
| 57 |
|
| 58 |
.. deprecated:: This field is deprecated."""
|
| 59 |
+
raw_attributes: dict[str, Any] | None = None
|
| 60 |
"""The raw attributes received from the directory provider.
|
| 61 |
|
| 62 |
.. deprecated:: This field is deprecated."""
|
| 63 |
+
role: SlimRole | None = None
|
| 64 |
+
roles: list[SlimRole] | None = None
|
| 65 |
"""All roles assigned to the user."""
|
| 66 |
|
| 67 |
@classmethod
|
| 68 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryUser:
|
| 69 |
"""Deserialize from a dictionary."""
|
| 70 |
try:
|
| 71 |
return cls(
|
|
|
|
| 83 |
last_name=data.get("last_name"),
|
| 84 |
name=data.get("name"),
|
| 85 |
emails=[
|
| 86 |
+
DirectoryUserEmail.from_dict(cast(dict[str, Any], item))
|
| 87 |
for item in cast(list[Any], _v_emails)
|
| 88 |
]
|
| 89 |
if (_v_emails := data.get("emails")) is not None
|
|
|
|
| 91 |
job_title=data.get("job_title"),
|
| 92 |
username=data.get("username"),
|
| 93 |
raw_attributes=data.get("raw_attributes"),
|
| 94 |
+
role=SlimRole.from_dict(cast(dict[str, Any], _v_role))
|
| 95 |
if (_v_role := data.get("role")) is not None
|
| 96 |
else None,
|
| 97 |
roles=[
|
| 98 |
+
SlimRole.from_dict(cast(dict[str, Any], item))
|
| 99 |
for item in cast(list[Any], _v_roles)
|
| 100 |
]
|
| 101 |
if (_v_roles := data.get("roles")) is not None
|
|
|
|
| 104 |
except (KeyError, ValueError) as e:
|
| 105 |
_raise_deserialize_error("DirectoryUser", e)
|
| 106 |
|
| 107 |
+
def to_dict(self) -> dict[str, Any]:
|
| 108 |
"""Serialize to a dictionary."""
|
| 109 |
+
result: dict[str, Any] = {}
|
| 110 |
result["object"] = self.object
|
| 111 |
result["id"] = self.id
|
| 112 |
result["directory_id"] = self.directory_id
|
python/src/workos/common/models/directory_user_email.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,15 +12,15 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class DirectoryUserEmail:
|
| 12 |
"""Directory User Email model."""
|
| 13 |
|
| 14 |
-
primary:
|
| 15 |
"""Whether this is the primary email address."""
|
| 16 |
-
type:
|
| 17 |
"""The type of email address."""
|
| 18 |
-
value:
|
| 19 |
"""The email address value."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class DirectoryUserEmail:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("DirectoryUserEmail", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
if self.primary is not None:
|
| 37 |
result["primary"] = self.primary
|
| 38 |
if self.type is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class DirectoryUserEmail:
|
| 13 |
"""Directory User Email model."""
|
| 14 |
|
| 15 |
+
primary: bool | None = None
|
| 16 |
"""Whether this is the primary email address."""
|
| 17 |
+
type: str | None = None
|
| 18 |
"""The type of email address."""
|
| 19 |
+
value: str | None = None
|
| 20 |
"""The email address value."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryUserEmail:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("DirectoryUserEmail", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
if self.primary is not None:
|
| 38 |
result["primary"] = self.primary
|
| 39 |
if self.type is not None:
|
python/src/workos/common/models/directory_user_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class DirectoryUserState(str, Enum):
|
|
| 17 |
INACTIVE = "inactive"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
INACTIVE = "inactive"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> DirectoryUserState | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/dsync_activated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_activated_data import DsyncActivatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncActivated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.activated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.activated"),
|
| 39 |
-
data=DsyncActivatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncActivated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_activated_data import DsyncActivatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.activated"]
|
| 24 |
+
data: DsyncActivatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncActivated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.activated"),
|
| 38 |
+
data=DsyncActivatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncActivated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_activated_data.py|
@@ -5,10 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .dsync_activated_data_domain import DsyncActivatedDataDomain
|
| 14 |
from .dsync_activated_data_state import DsyncActivatedDataState
|
|
@@ -23,9 +22,9 @@ class DsyncActivatedData:
|
|
| 23 |
"""Distinguishes the directory object."""
|
| 24 |
id: str
|
| 25 |
"""Unique identifier of the directory."""
|
| 26 |
-
type:
|
| 27 |
"""The type of the directory."""
|
| 28 |
-
state:
|
| 29 |
"""The current state of the directory."""
|
| 30 |
name: str
|
| 31 |
"""The name of the directory."""
|
|
@@ -35,13 +34,13 @@ class DsyncActivatedData:
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
external_key: str
|
| 37 |
"""The external key of the directory."""
|
| 38 |
-
domains:
|
| 39 |
"""The domains associated with the directory."""
|
| 40 |
-
organization_id:
|
| 41 |
"""The ID of the organization the directory belongs to."""
|
| 42 |
|
| 43 |
@classmethod
|
| 44 |
-
def from_dict(cls, data:
|
| 45 |
"""Deserialize from a dictionary."""
|
| 46 |
try:
|
| 47 |
return cls(
|
|
@@ -54,7 +53,7 @@ class DsyncActivatedData:
|
|
| 54 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 55 |
external_key=data["external_key"],
|
| 56 |
domains=[
|
| 57 |
-
DsyncActivatedDataDomain.from_dict(cast(
|
| 58 |
for item in cast(list[Any], data["domains"])
|
| 59 |
],
|
| 60 |
organization_id=data.get("organization_id"),
|
|
@@ -62,9 +61,9 @@ class DsyncActivatedData:
|
|
| 62 |
except (KeyError, ValueError) as e:
|
| 63 |
_raise_deserialize_error("DsyncActivatedData", e)
|
| 64 |
|
| 65 |
-
def to_dict(self) ->
|
| 66 |
"""Serialize to a dictionary."""
|
| 67 |
-
result:
|
| 68 |
result["object"] = self.object
|
| 69 |
result["id"] = self.id
|
| 70 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .dsync_activated_data_domain import DsyncActivatedDataDomain
|
| 13 |
from .dsync_activated_data_state import DsyncActivatedDataState
|
|
|
|
| 22 |
"""Distinguishes the directory object."""
|
| 23 |
id: str
|
| 24 |
"""Unique identifier of the directory."""
|
| 25 |
+
type: DsyncActivatedDataType
|
| 26 |
"""The type of the directory."""
|
| 27 |
+
state: DsyncActivatedDataState
|
| 28 |
"""The current state of the directory."""
|
| 29 |
name: str
|
| 30 |
"""The name of the directory."""
|
|
|
|
| 34 |
"""An ISO 8601 timestamp."""
|
| 35 |
external_key: str
|
| 36 |
"""The external key of the directory."""
|
| 37 |
+
domains: list[DsyncActivatedDataDomain]
|
| 38 |
"""The domains associated with the directory."""
|
| 39 |
+
organization_id: str | None = None
|
| 40 |
"""The ID of the organization the directory belongs to."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncActivatedData:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
|
|
|
| 53 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 54 |
external_key=data["external_key"],
|
| 55 |
domains=[
|
| 56 |
+
DsyncActivatedDataDomain.from_dict(cast(dict[str, Any], item))
|
| 57 |
for item in cast(list[Any], data["domains"])
|
| 58 |
],
|
| 59 |
organization_id=data.get("organization_id"),
|
|
|
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("DsyncActivatedData", e)
|
| 63 |
|
| 64 |
+
def to_dict(self) -> dict[str, Any]:
|
| 65 |
"""Serialize to a dictionary."""
|
| 66 |
+
result: dict[str, Any] = {}
|
| 67 |
result["object"] = self.object
|
| 68 |
result["id"] = self.id
|
| 69 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
python/src/workos/common/models/dsync_activated_data_domain.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,7 +20,7 @@ class DsyncActivatedDataDomain:
|
|
| 19 |
"""The domain value."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class DsyncActivatedDataDomain:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("DsyncActivatedDataDomain", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["object"] = self.object
|
| 37 |
result["id"] = self.id
|
| 38 |
result["domain"] = self.domain
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The domain value."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncActivatedDataDomain:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("DsyncActivatedDataDomain", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["object"] = self.object
|
| 38 |
result["id"] = self.id
|
| 39 |
result["domain"] = self.domain
|
python/src/workos/common/models/dsync_activated_data_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,7 +18,7 @@ class DsyncActivatedDataState(str, Enum):
|
|
| 19 |
DELETING = "deleting"
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def _missing_(cls, value: object) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
DELETING = "deleting"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def _missing_(cls, value: object) -> DsyncActivatedDataState | None:
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/dsync_activated_data_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -37,7 +36,7 @@ class DsyncActivatedDataType(str, Enum):
|
|
| 37 |
WORKDAY = "workday"
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
-
def _missing_(cls, value: object) ->
|
| 41 |
if not isinstance(value, str):
|
| 42 |
return None
|
| 43 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 36 |
WORKDAY = "workday"
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
+
def _missing_(cls, value: object) -> DsyncActivatedDataType | None:
|
| 40 |
if not isinstance(value, str):
|
| 41 |
return None
|
| 42 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/dsync_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_deleted_data import DsyncDeletedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.deleted"),
|
| 39 |
-
data=DsyncDeletedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_deleted_data import DsyncDeletedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.deleted"]
|
| 24 |
+
data: DsyncDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.deleted"),
|
| 38 |
+
data=DsyncDeletedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_deleted_data.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .dsync_deleted_data_state import DsyncDeletedDataState
|
| 12 |
from .dsync_deleted_data_type import DsyncDeletedDataType
|
| 13 |
|
|
@@ -20,9 +21,9 @@ class DsyncDeletedData:
|
|
| 20 |
"""Distinguishes the directory object."""
|
| 21 |
id: str
|
| 22 |
"""Unique identifier of the directory."""
|
| 23 |
-
type:
|
| 24 |
"""The type of the directory."""
|
| 25 |
-
state:
|
| 26 |
"""The current state of the directory."""
|
| 27 |
name: str
|
| 28 |
"""The name of the directory."""
|
|
@@ -30,11 +31,11 @@ class DsyncDeletedData:
|
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
updated_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
-
organization_id:
|
| 34 |
"""The ID of the organization the directory belongs to."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
@@ -50,9 +51,9 @@ class DsyncDeletedData:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("DsyncDeletedData", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .dsync_deleted_data_state import DsyncDeletedDataState
|
| 13 |
from .dsync_deleted_data_type import DsyncDeletedDataType
|
| 14 |
|
|
|
|
| 21 |
"""Distinguishes the directory object."""
|
| 22 |
id: str
|
| 23 |
"""Unique identifier of the directory."""
|
| 24 |
+
type: DsyncDeletedDataType
|
| 25 |
"""The type of the directory."""
|
| 26 |
+
state: DsyncDeletedDataState
|
| 27 |
"""The current state of the directory."""
|
| 28 |
name: str
|
| 29 |
"""The name of the directory."""
|
|
|
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
updated_at: datetime
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
+
organization_id: str | None = None
|
| 35 |
"""The ID of the organization the directory belongs to."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncDeletedData:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
|
|
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("DsyncDeletedData", e)
|
| 53 |
|
| 54 |
+
def to_dict(self) -> dict[str, Any]:
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
+
result: dict[str, Any] = {}
|
| 57 |
result["object"] = self.object
|
| 58 |
result["id"] = self.id
|
| 59 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
python/src/workos/common/models/dsync_group_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .directory_group import DirectoryGroup
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncGroupCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.group.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.group.created"),
|
| 39 |
-
data=DirectoryGroup.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncGroupCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .directory_group import DirectoryGroup
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.group.created"]
|
| 24 |
+
data: DirectoryGroup
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.group.created"),
|
| 38 |
+
data=DirectoryGroup.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncGroupCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_group_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .directory_group import DirectoryGroup
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncGroupDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.group.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.group.deleted"),
|
| 39 |
-
data=DirectoryGroup.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncGroupDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .directory_group import DirectoryGroup
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.group.deleted"]
|
| 24 |
+
data: DirectoryGroup
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.group.deleted"),
|
| 38 |
+
data=DirectoryGroup.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncGroupDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_group_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_group_updated_data import DsyncGroupUpdatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class DsyncGroupUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.group.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class DsyncGroupUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.group.updated"),
|
| 39 |
data=DsyncGroupUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("DsyncGroupUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_group_updated_data import DsyncGroupUpdatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.group.updated"]
|
| 24 |
+
data: DsyncGroupUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.group.updated"),
|
| 38 |
data=DsyncGroupUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("DsyncGroupUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_group_updated_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -29,12 +29,12 @@ class DsyncGroupUpdatedData:
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
-
raw_attributes:
|
| 33 |
"""The raw attributes received from the directory provider."""
|
| 34 |
-
previous_attributes:
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
@@ -52,9 +52,9 @@ class DsyncGroupUpdatedData:
|
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("DsyncGroupUpdatedData", e)
|
| 54 |
|
| 55 |
-
def to_dict(self) ->
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
-
result:
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["idp_id"] = self.idp_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
+
raw_attributes: dict[str, Any] | None = None
|
| 33 |
"""The raw attributes received from the directory provider."""
|
| 34 |
+
previous_attributes: dict[str, Any] | None = None
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupUpdatedData:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("DsyncGroupUpdatedData", e)
|
| 54 |
|
| 55 |
+
def to_dict(self) -> dict[str, Any]:
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
+
result: dict[str, Any] = {}
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["idp_id"] = self.idp_id
|
python/src/workos/common/models/dsync_group_user_added.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_group_user_added_data import DsyncGroupUserAddedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class DsyncGroupUserAdded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.group.user_added"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class DsyncGroupUserAdded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.group.user_added"),
|
| 39 |
data=DsyncGroupUserAddedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("DsyncGroupUserAdded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_group_user_added_data import DsyncGroupUserAddedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.group.user_added"]
|
| 24 |
+
data: DsyncGroupUserAddedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupUserAdded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.group.user_added"),
|
| 38 |
data=DsyncGroupUserAddedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("DsyncGroupUserAdded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_group_user_removed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_group_user_removed_data import DsyncGroupUserRemovedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class DsyncGroupUserRemoved:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.group.user_removed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class DsyncGroupUserRemoved:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.group.user_removed"),
|
| 39 |
data=DsyncGroupUserRemovedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("DsyncGroupUserRemoved", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_group_user_removed_data import DsyncGroupUserRemovedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.group.user_removed"]
|
| 24 |
+
data: DsyncGroupUserRemovedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncGroupUserRemoved:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.group.user_removed"),
|
| 38 |
data=DsyncGroupUserRemovedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("DsyncGroupUserRemoved", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_token_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_token_created_data import DsyncTokenCreatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class DsyncTokenCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.token.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class DsyncTokenCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.token.created"),
|
| 39 |
data=DsyncTokenCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("DsyncTokenCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_token_created_data import DsyncTokenCreatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.token.created"]
|
| 24 |
+
data: DsyncTokenCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncTokenCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.token.created"),
|
| 38 |
data=DsyncTokenCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("DsyncTokenCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_token_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -23,11 +23,11 @@ class DsyncTokenCreatedData:
|
|
| 23 |
"""The trailing characters of the bearer token, for identification only. The full token value is never included in events."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
-
organization_id:
|
| 27 |
"""The ID of the organization the directory belongs to."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -41,9 +41,9 @@ class DsyncTokenCreatedData:
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("DsyncTokenCreatedData", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
result["object"] = self.object
|
| 48 |
result["id"] = self.id
|
| 49 |
result["directory_id"] = self.directory_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 23 |
"""The trailing characters of the bearer token, for identification only. The full token value is never included in events."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
+
organization_id: str | None = None
|
| 27 |
"""The ID of the organization the directory belongs to."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncTokenCreatedData:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("DsyncTokenCreatedData", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["object"] = self.object
|
| 48 |
result["id"] = self.id
|
| 49 |
result["directory_id"] = self.directory_id
|
python/src/workos/common/models/dsync_token_revoked.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_token_revoked_data import DsyncTokenRevokedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class DsyncTokenRevoked:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.token.revoked"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class DsyncTokenRevoked:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.token.revoked"),
|
| 39 |
data=DsyncTokenRevokedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("DsyncTokenRevoked", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_token_revoked_data import DsyncTokenRevokedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.token.revoked"]
|
| 24 |
+
data: DsyncTokenRevokedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncTokenRevoked:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.token.revoked"),
|
| 38 |
data=DsyncTokenRevokedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("DsyncTokenRevoked", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_user_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .directory_user import DirectoryUser
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncUserCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.user.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.user.created"),
|
| 39 |
-
data=DirectoryUser.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncUserCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .directory_user import DirectoryUser
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.user.created"]
|
| 24 |
+
data: DirectoryUser
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncUserCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.user.created"),
|
| 38 |
+
data=DirectoryUser.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncUserCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_user_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .directory_user import DirectoryUser
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncUserDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.user.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.user.deleted"),
|
| 39 |
-
data=DirectoryUser.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncUserDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .directory_user import DirectoryUser
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.user.deleted"]
|
| 24 |
+
data: DirectoryUser
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncUserDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.user.deleted"),
|
| 38 |
+
data=DirectoryUser.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncUserDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_user_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .dsync_user_updated_data import DsyncUserUpdatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,32 +21,32 @@ class DsyncUserUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["dsync.user.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "dsync.user.updated"),
|
| 39 |
-
data=DsyncUserUpdatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("DsyncUserUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .dsync_user_updated_data import DsyncUserUpdatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["dsync.user.updated"]
|
| 24 |
+
data: DsyncUserUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncUserUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "dsync.user.updated"),
|
| 38 |
+
data=DsyncUserUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("DsyncUserUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/dsync_user_updated_data.py|
@@ -5,14 +5,13 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .dsync_user_updated_data_email import DsyncUserUpdatedDataEmail
|
| 14 |
-
from .slim_role import SlimRole
|
| 15 |
from .dsync_user_updated_data_state import DsyncUserUpdatedDataState
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
|
@@ -29,45 +28,45 @@ class DsyncUserUpdatedData:
|
|
| 29 |
"""The identifier for the Organization in which the Directory resides."""
|
| 30 |
idp_id: str
|
| 31 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 32 |
-
email:
|
| 33 |
"""The email address of the user."""
|
| 34 |
-
state:
|
| 35 |
"""The state of the user."""
|
| 36 |
-
custom_attributes:
|
| 37 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 38 |
created_at: datetime
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
updated_at: datetime
|
| 41 |
"""An ISO 8601 timestamp."""
|
| 42 |
-
first_name:
|
| 43 |
"""The first name of the user."""
|
| 44 |
-
last_name:
|
| 45 |
"""The last name of the user."""
|
| 46 |
-
name:
|
| 47 |
"""The full name of the user."""
|
| 48 |
-
emails:
|
| 49 |
"""A list of email addresses for the user.
|
| 50 |
|
| 51 |
.. deprecated:: This field is deprecated."""
|
| 52 |
-
job_title:
|
| 53 |
"""The job title of the user.
|
| 54 |
|
| 55 |
.. deprecated:: This field is deprecated."""
|
| 56 |
-
username:
|
| 57 |
"""The username of the user.
|
| 58 |
|
| 59 |
.. deprecated:: This field is deprecated."""
|
| 60 |
-
raw_attributes:
|
| 61 |
"""The raw attributes received from the directory provider.
|
| 62 |
|
| 63 |
.. deprecated:: This field is deprecated."""
|
| 64 |
-
role:
|
| 65 |
-
roles:
|
| 66 |
"""All roles assigned to the user."""
|
| 67 |
-
previous_attributes:
|
| 68 |
|
| 69 |
@classmethod
|
| 70 |
-
def from_dict(cls, data:
|
| 71 |
"""Deserialize from a dictionary."""
|
| 72 |
try:
|
| 73 |
return cls(
|
|
@@ -85,7 +84,7 @@ class DsyncUserUpdatedData:
|
|
| 85 |
last_name=data.get("last_name"),
|
| 86 |
name=data.get("name"),
|
| 87 |
emails=[
|
| 88 |
-
DsyncUserUpdatedDataEmail.from_dict(cast(
|
| 89 |
for item in cast(list[Any], _v_emails)
|
| 90 |
]
|
| 91 |
if (_v_emails := data.get("emails")) is not None
|
|
@@ -93,11 +92,11 @@ class DsyncUserUpdatedData:
|
|
| 93 |
job_title=data.get("job_title"),
|
| 94 |
username=data.get("username"),
|
| 95 |
raw_attributes=data.get("raw_attributes"),
|
| 96 |
-
role=SlimRole.from_dict(cast(
|
| 97 |
if (_v_role := data.get("role")) is not None
|
| 98 |
else None,
|
| 99 |
roles=[
|
| 100 |
-
SlimRole.from_dict(cast(
|
| 101 |
for item in cast(list[Any], _v_roles)
|
| 102 |
]
|
| 103 |
if (_v_roles := data.get("roles")) is not None
|
|
@@ -107,9 +106,9 @@ class DsyncUserUpdatedData:
|
|
| 107 |
except (KeyError, ValueError) as e:
|
| 108 |
_raise_deserialize_error("DsyncUserUpdatedData", e)
|
| 109 |
|
| 110 |
-
def to_dict(self) ->
|
| 111 |
"""Serialize to a dictionary."""
|
| 112 |
-
result:
|
| 113 |
result["object"] = self.object
|
| 114 |
result["id"] = self.id
|
| 115 |
result["directory_id"] = self.directory_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .dsync_user_updated_data_email import DsyncUserUpdatedDataEmail
|
|
|
|
| 13 |
from .dsync_user_updated_data_state import DsyncUserUpdatedDataState
|
| 14 |
+
from .slim_role import SlimRole
|
| 15 |
|
| 16 |
|
| 17 |
@dataclass(slots=True)
|
|
|
|
| 28 |
"""The identifier for the Organization in which the Directory resides."""
|
| 29 |
idp_id: str
|
| 30 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 31 |
+
email: str | None
|
| 32 |
"""The email address of the user."""
|
| 33 |
+
state: DsyncUserUpdatedDataState
|
| 34 |
"""The state of the user."""
|
| 35 |
+
custom_attributes: dict[str, Any]
|
| 36 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 37 |
created_at: datetime
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
updated_at: datetime
|
| 40 |
"""An ISO 8601 timestamp."""
|
| 41 |
+
first_name: str | None = None
|
| 42 |
"""The first name of the user."""
|
| 43 |
+
last_name: str | None = None
|
| 44 |
"""The last name of the user."""
|
| 45 |
+
name: str | None = None
|
| 46 |
"""The full name of the user."""
|
| 47 |
+
emails: list[DsyncUserUpdatedDataEmail] | None = None
|
| 48 |
"""A list of email addresses for the user.
|
| 49 |
|
| 50 |
.. deprecated:: This field is deprecated."""
|
| 51 |
+
job_title: str | None = None
|
| 52 |
"""The job title of the user.
|
| 53 |
|
| 54 |
.. deprecated:: This field is deprecated."""
|
| 55 |
+
username: str | None = None
|
| 56 |
"""The username of the user.
|
| 57 |
|
| 58 |
.. deprecated:: This field is deprecated."""
|
| 59 |
+
raw_attributes: dict[str, Any] | None = None
|
| 60 |
"""The raw attributes received from the directory provider.
|
| 61 |
|
| 62 |
.. deprecated:: This field is deprecated."""
|
| 63 |
+
role: SlimRole | None = None
|
| 64 |
+
roles: list[SlimRole] | None = None
|
| 65 |
"""All roles assigned to the user."""
|
| 66 |
+
previous_attributes: dict[str, Any] | None = None
|
| 67 |
|
| 68 |
@classmethod
|
| 69 |
+
def from_dict(cls, data: dict[str, Any]) -> DsyncUserUpdatedData:
|
| 70 |
"""Deserialize from a dictionary."""
|
| 71 |
try:
|
| 72 |
return cls(
|
|
|
|
| 84 |
last_name=data.get("last_name"),
|
| 85 |
name=data.get("name"),
|
| 86 |
emails=[
|
| 87 |
+
DsyncUserUpdatedDataEmail.from_dict(cast(dict[str, Any], item))
|
| 88 |
for item in cast(list[Any], _v_emails)
|
| 89 |
]
|
| 90 |
if (_v_emails := data.get("emails")) is not None
|
|
|
|
| 92 |
job_title=data.get("job_title"),
|
| 93 |
username=data.get("username"),
|
| 94 |
raw_attributes=data.get("raw_attributes"),
|
| 95 |
+
role=SlimRole.from_dict(cast(dict[str, Any], _v_role))
|
| 96 |
if (_v_role := data.get("role")) is not None
|
| 97 |
else None,
|
| 98 |
roles=[
|
| 99 |
+
SlimRole.from_dict(cast(dict[str, Any], item))
|
| 100 |
for item in cast(list[Any], _v_roles)
|
| 101 |
]
|
| 102 |
if (_v_roles := data.get("roles")) is not None
|
|
|
|
| 106 |
except (KeyError, ValueError) as e:
|
| 107 |
_raise_deserialize_error("DsyncUserUpdatedData", e)
|
| 108 |
|
| 109 |
+
def to_dict(self) -> dict[str, Any]:
|
| 110 |
"""Serialize to a dictionary."""
|
| 111 |
+
result: dict[str, Any] = {}
|
| 112 |
result["object"] = self.object
|
| 113 |
result["id"] = self.id
|
| 114 |
result["directory_id"] = self.directory_id
|
python/src/workos/common/models/email_verification_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .email_verification_created_data import EmailVerificationCreatedData
|
| 13 |
from .event_context import EventContext
|
|
@@ -22,14 +21,14 @@ class EmailVerificationCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["email_verification.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class EmailVerificationCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "email_verification.created"),
|
| 39 |
data=EmailVerificationCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("EmailVerificationCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .email_verification_created_data import EmailVerificationCreatedData
|
| 12 |
from .event_context import EventContext
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["email_verification.created"]
|
| 24 |
+
data: EmailVerificationCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> EmailVerificationCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "email_verification.created"),
|
| 38 |
data=EmailVerificationCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("EmailVerificationCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/email_verification_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -29,7 +29,7 @@ class EmailVerificationCreatedData:
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -44,9 +44,9 @@ class EmailVerificationCreatedData:
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("EmailVerificationCreatedData", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["user_id"] = self.user_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> EmailVerificationCreatedData:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("EmailVerificationCreatedData", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/error_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class ErrorResponse:
|
|
| 15 |
"""A human-readable description of the error."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class ErrorResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("ErrorResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["error"] = self.error
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""A human-readable description of the error."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> ErrorResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("ErrorResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["error"] = self.error
|
| 32 |
return result
|
python/src/workos/common/models/event_context.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .event_context_actor import EventContextActor
|
|
@@ -15,29 +15,27 @@ from .event_context_google_analytics_session import EventContextGoogleAnalyticsS
|
|
| 15 |
class EventContext:
|
| 16 |
"""Additional context about the event."""
|
| 17 |
|
| 18 |
-
google_analytics_client_id:
|
| 19 |
"""The Google Analytics client ID."""
|
| 20 |
-
google_analytics_sessions:
|
| 21 |
-
None
|
| 22 |
-
)
|
| 23 |
"""The Google Analytics sessions associated with the event."""
|
| 24 |
-
ajs_anonymous_id:
|
| 25 |
"""The anonymous ID from analytics."""
|
| 26 |
-
client_id:
|
| 27 |
"""The client ID associated with the event."""
|
| 28 |
-
actor:
|
| 29 |
-
previous_attributes:
|
| 30 |
"""Attributes that changed from their previous values."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
google_analytics_client_id=data.get("google_analytics_client_id"),
|
| 38 |
google_analytics_sessions=[
|
| 39 |
EventContextGoogleAnalyticsSession.from_dict(
|
| 40 |
-
cast(
|
| 41 |
)
|
| 42 |
for item in cast(list[Any], _v_google_analytics_sessions)
|
| 43 |
]
|
|
@@ -50,7 +48,7 @@ class EventContext:
|
|
| 50 |
else None,
|
| 51 |
ajs_anonymous_id=data.get("ajs_anonymous_id"),
|
| 52 |
client_id=data.get("client_id"),
|
| 53 |
-
actor=EventContextActor.from_dict(cast(
|
| 54 |
if (_v_actor := data.get("actor")) is not None
|
| 55 |
else None,
|
| 56 |
previous_attributes=data.get("previous_attributes"),
|
|
@@ -58,9 +56,9 @@ class EventContext:
|
|
| 58 |
except (KeyError, ValueError) as e:
|
| 59 |
_raise_deserialize_error("EventContext", e)
|
| 60 |
|
| 61 |
-
def to_dict(self) ->
|
| 62 |
"""Serialize to a dictionary."""
|
| 63 |
-
result:
|
| 64 |
if self.google_analytics_client_id is not None:
|
| 65 |
result["google_analytics_client_id"] = self.google_analytics_client_id
|
| 66 |
if self.google_analytics_sessions is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .event_context_actor import EventContextActor
|
|
|
|
| 15 |
class EventContext:
|
| 16 |
"""Additional context about the event."""
|
| 17 |
|
| 18 |
+
google_analytics_client_id: str | None = None
|
| 19 |
"""The Google Analytics client ID."""
|
| 20 |
+
google_analytics_sessions: list[EventContextGoogleAnalyticsSession] | None = None
|
|
|
|
|
|
|
| 21 |
"""The Google Analytics sessions associated with the event."""
|
| 22 |
+
ajs_anonymous_id: str | None = None
|
| 23 |
"""The anonymous ID from analytics."""
|
| 24 |
+
client_id: str | None = None
|
| 25 |
"""The client ID associated with the event."""
|
| 26 |
+
actor: EventContextActor | None = None
|
| 27 |
+
previous_attributes: dict[str, Any] | None = None
|
| 28 |
"""Attributes that changed from their previous values."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> EventContext:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
google_analytics_client_id=data.get("google_analytics_client_id"),
|
| 36 |
google_analytics_sessions=[
|
| 37 |
EventContextGoogleAnalyticsSession.from_dict(
|
| 38 |
+
cast(dict[str, Any], item)
|
| 39 |
)
|
| 40 |
for item in cast(list[Any], _v_google_analytics_sessions)
|
| 41 |
]
|
|
|
|
| 48 |
else None,
|
| 49 |
ajs_anonymous_id=data.get("ajs_anonymous_id"),
|
| 50 |
client_id=data.get("client_id"),
|
| 51 |
+
actor=EventContextActor.from_dict(cast(dict[str, Any], _v_actor))
|
| 52 |
if (_v_actor := data.get("actor")) is not None
|
| 53 |
else None,
|
| 54 |
previous_attributes=data.get("previous_attributes"),
|
|
|
|
| 56 |
except (KeyError, ValueError) as e:
|
| 57 |
_raise_deserialize_error("EventContext", e)
|
| 58 |
|
| 59 |
+
def to_dict(self) -> dict[str, Any]:
|
| 60 |
"""Serialize to a dictionary."""
|
| 61 |
+
result: dict[str, Any] = {}
|
| 62 |
if self.google_analytics_client_id is not None:
|
| 63 |
result["google_analytics_client_id"] = self.google_analytics_client_id
|
| 64 |
if self.google_analytics_sessions is not None:
|
python/src/workos/common/models/event_context_actor.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .event_context_actor_source import EventContextActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,13 +17,13 @@ class EventContextActor:
|
|
| 15 |
|
| 16 |
id: str
|
| 17 |
"""Unique identifier of the actor."""
|
| 18 |
-
source:
|
| 19 |
"""The source of the actor that performed the action."""
|
| 20 |
-
name:
|
| 21 |
"""The name of the actor."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -32,9 +34,9 @@ class EventContextActor:
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("EventContextActor", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["id"] = self.id
|
| 39 |
result["source"] = (
|
| 40 |
self.source.value if isinstance(self.source, Enum) else self.source
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .event_context_actor_source import EventContextActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
id: str
|
| 19 |
"""Unique identifier of the actor."""
|
| 20 |
+
source: EventContextActorSource
|
| 21 |
"""The source of the actor that performed the action."""
|
| 22 |
+
name: str | None
|
| 23 |
"""The name of the actor."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> EventContextActor:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("EventContextActor", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["id"] = self.id
|
| 41 |
result["source"] = (
|
| 42 |
self.source.value if isinstance(self.source, Enum) else self.source
|
python/src/workos/common/models/event_context_actor_source.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class EventContextActorSource(str, Enum):
|
|
| 18 |
SYSTEM = "system"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(cls, value: object) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
SYSTEM = "system"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def _missing_(cls, value: object) -> EventContextActorSource | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/event_context_google_analytics_session.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,13 +14,13 @@ class EventContextGoogleAnalyticsSession:
|
|
| 13 |
|
| 14 |
container_id: str
|
| 15 |
"""The Google Analytics container ID."""
|
| 16 |
-
session_id:
|
| 17 |
"""The Google Analytics session ID."""
|
| 18 |
-
session_number:
|
| 19 |
"""The Google Analytics session number."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class EventContextGoogleAnalyticsSession:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("EventContextGoogleAnalyticsSession", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["containerId"] = self.container_id
|
| 37 |
if self.session_id is not None:
|
| 38 |
result["sessionId"] = self.session_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
container_id: str
|
| 16 |
"""The Google Analytics container ID."""
|
| 17 |
+
session_id: str | None = None
|
| 18 |
"""The Google Analytics session ID."""
|
| 19 |
+
session_number: str | None = None
|
| 20 |
"""The Google Analytics session number."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> EventContextGoogleAnalyticsSession:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("EventContextGoogleAnalyticsSession", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["containerId"] = self.container_id
|
| 38 |
if self.session_id is not None:
|
| 39 |
result["sessionId"] = self.session_id
|
python/src/workos/common/models/feature_flag.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .feature_flag_owner import FeatureFlagOwner
|
| 13 |
|
|
@@ -24,11 +23,11 @@ class FeatureFlag:
|
|
| 24 |
"""A unique key to reference the Feature Flag."""
|
| 25 |
name: str
|
| 26 |
"""A descriptive name for the Feature Flag. This field does not need to be unique."""
|
| 27 |
-
description:
|
| 28 |
"""A description for the Feature Flag."""
|
| 29 |
-
owner:
|
| 30 |
"""The owner of the Feature Flag."""
|
| 31 |
-
tags:
|
| 32 |
"""Labels assigned to the Feature Flag for categorizing and filtering."""
|
| 33 |
enabled: bool
|
| 34 |
"""Specifies whether the Feature Flag is active for the current environment."""
|
|
@@ -40,7 +39,7 @@ class FeatureFlag:
|
|
| 40 |
"""An ISO 8601 timestamp."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
-
def from_dict(cls, data:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
|
@@ -49,7 +48,7 @@ class FeatureFlag:
|
|
| 49 |
slug=data["slug"],
|
| 50 |
name=data["name"],
|
| 51 |
description=data["description"],
|
| 52 |
-
owner=FeatureFlagOwner.from_dict(cast(
|
| 53 |
if (_v_owner := data["owner"]) is not None
|
| 54 |
else None,
|
| 55 |
tags=data["tags"],
|
|
@@ -61,9 +60,9 @@ class FeatureFlag:
|
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("FeatureFlag", e)
|
| 63 |
|
| 64 |
-
def to_dict(self) ->
|
| 65 |
"""Serialize to a dictionary."""
|
| 66 |
-
result:
|
| 67 |
result["object"] = self.object
|
| 68 |
result["id"] = self.id
|
| 69 |
result["slug"] = self.slug
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .feature_flag_owner import FeatureFlagOwner
|
| 12 |
|
|
|
|
| 23 |
"""A unique key to reference the Feature Flag."""
|
| 24 |
name: str
|
| 25 |
"""A descriptive name for the Feature Flag. This field does not need to be unique."""
|
| 26 |
+
description: str | None
|
| 27 |
"""A description for the Feature Flag."""
|
| 28 |
+
owner: FeatureFlagOwner | None
|
| 29 |
"""The owner of the Feature Flag."""
|
| 30 |
+
tags: list[str]
|
| 31 |
"""Labels assigned to the Feature Flag for categorizing and filtering."""
|
| 32 |
enabled: bool
|
| 33 |
"""Specifies whether the Feature Flag is active for the current environment."""
|
|
|
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
|
| 41 |
@classmethod
|
| 42 |
+
def from_dict(cls, data: dict[str, Any]) -> FeatureFlag:
|
| 43 |
"""Deserialize from a dictionary."""
|
| 44 |
try:
|
| 45 |
return cls(
|
|
|
|
| 48 |
slug=data["slug"],
|
| 49 |
name=data["name"],
|
| 50 |
description=data["description"],
|
| 51 |
+
owner=FeatureFlagOwner.from_dict(cast(dict[str, Any], _v_owner))
|
| 52 |
if (_v_owner := data["owner"]) is not None
|
| 53 |
else None,
|
| 54 |
tags=data["tags"],
|
|
|
|
| 60 |
except (KeyError, ValueError) as e:
|
| 61 |
_raise_deserialize_error("FeatureFlag", e)
|
| 62 |
|
| 63 |
+
def to_dict(self) -> dict[str, Any]:
|
| 64 |
"""Serialize to a dictionary."""
|
| 65 |
+
result: dict[str, Any] = {}
|
| 66 |
result["object"] = self.object
|
| 67 |
result["id"] = self.id
|
| 68 |
result["slug"] = self.slug
|
python/src/workos/common/models/feature_flag_owner.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,13 +14,13 @@ class FeatureFlagOwner:
|
|
| 13 |
|
| 14 |
email: str
|
| 15 |
"""The email address of the flag owner."""
|
| 16 |
-
first_name:
|
| 17 |
"""The first name of the flag owner."""
|
| 18 |
-
last_name:
|
| 19 |
"""The last name of the flag owner."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class FeatureFlagOwner:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("FeatureFlagOwner", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["email"] = self.email
|
| 37 |
if self.first_name is not None:
|
| 38 |
result["first_name"] = self.first_name
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
email: str
|
| 16 |
"""The email address of the flag owner."""
|
| 17 |
+
first_name: str | None
|
| 18 |
"""The first name of the flag owner."""
|
| 19 |
+
last_name: str | None
|
| 20 |
"""The last name of the flag owner."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> FeatureFlagOwner:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("FeatureFlagOwner", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["email"] = self.email
|
| 38 |
if self.first_name is not None:
|
| 39 |
result["first_name"] = self.first_name
|
python/src/workos/common/models/flag_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .flag_created_context import FlagCreatedContext
|
| 13 |
from .flag_created_data import FlagCreatedData
|
|
@@ -22,33 +21,33 @@ class FlagCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["flag.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
"""Additional context about the event."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
object=data.get("object", "event"),
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "flag.created"),
|
| 40 |
-
data=FlagCreatedData.from_dict(cast(
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
context=FlagCreatedContext.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("FlagCreated", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .flag_created_context import FlagCreatedContext
|
| 12 |
from .flag_created_data import FlagCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["flag.created"]
|
| 24 |
+
data: FlagCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: FlagCreatedContext
|
| 29 |
"""Additional context about the event."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagCreated:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "flag.created"),
|
| 39 |
+
data=FlagCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
context=FlagCreatedContext.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["context"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagCreated", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
python/src/workos/common/models/flag_created_context.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_created_context_actor import FlagCreatedContextActor
|
|
@@ -16,25 +16,25 @@ class FlagCreatedContext:
|
|
| 16 |
|
| 17 |
client_id: str
|
| 18 |
"""The client ID associated with the flag event."""
|
| 19 |
-
actor:
|
| 20 |
"""The actor who performed the action."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
client_id=data["client_id"],
|
| 28 |
actor=FlagCreatedContextActor.from_dict(
|
| 29 |
-
cast(
|
| 30 |
),
|
| 31 |
)
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("FlagCreatedContext", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["client_id"] = self.client_id
|
| 39 |
result["actor"] = self.actor.to_dict()
|
| 40 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_created_context_actor import FlagCreatedContextActor
|
|
|
|
| 16 |
|
| 17 |
client_id: str
|
| 18 |
"""The client ID associated with the flag event."""
|
| 19 |
+
actor: FlagCreatedContextActor
|
| 20 |
"""The actor who performed the action."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagCreatedContext:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
client_id=data["client_id"],
|
| 28 |
actor=FlagCreatedContextActor.from_dict(
|
| 29 |
+
cast(dict[str, Any], data["actor"])
|
| 30 |
),
|
| 31 |
)
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("FlagCreatedContext", e)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["client_id"] = self.client_id
|
| 39 |
result["actor"] = self.actor.to_dict()
|
| 40 |
return result
|
python/src/workos/common/models/flag_created_data.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .flag_created_data_owner import FlagCreatedDataOwner
|
| 13 |
|
|
@@ -25,11 +24,11 @@ class FlagCreatedData:
|
|
| 25 |
"""A unique key to reference the Feature Flag."""
|
| 26 |
name: str
|
| 27 |
"""A descriptive name for the Feature Flag."""
|
| 28 |
-
description:
|
| 29 |
"""A description for the Feature Flag."""
|
| 30 |
-
owner:
|
| 31 |
"""The owner of the Feature Flag."""
|
| 32 |
-
tags:
|
| 33 |
"""Labels assigned to the Feature Flag for categorizing and filtering."""
|
| 34 |
enabled: bool
|
| 35 |
"""Specifies whether the Feature Flag is active for the current environment."""
|
|
@@ -41,7 +40,7 @@ class FlagCreatedData:
|
|
| 41 |
"""An ISO 8601 timestamp."""
|
| 42 |
|
| 43 |
@classmethod
|
| 44 |
-
def from_dict(cls, data:
|
| 45 |
"""Deserialize from a dictionary."""
|
| 46 |
try:
|
| 47 |
return cls(
|
|
@@ -51,7 +50,7 @@ class FlagCreatedData:
|
|
| 51 |
slug=data["slug"],
|
| 52 |
name=data["name"],
|
| 53 |
description=data["description"],
|
| 54 |
-
owner=FlagCreatedDataOwner.from_dict(cast(
|
| 55 |
if (_v_owner := data["owner"]) is not None
|
| 56 |
else None,
|
| 57 |
tags=data["tags"],
|
|
@@ -63,9 +62,9 @@ class FlagCreatedData:
|
|
| 63 |
except (KeyError, ValueError) as e:
|
| 64 |
_raise_deserialize_error("FlagCreatedData", e)
|
| 65 |
|
| 66 |
-
def to_dict(self) ->
|
| 67 |
"""Serialize to a dictionary."""
|
| 68 |
-
result:
|
| 69 |
result["object"] = self.object
|
| 70 |
result["id"] = self.id
|
| 71 |
result["environment_id"] = self.environment_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .flag_created_data_owner import FlagCreatedDataOwner
|
| 12 |
|
|
|
|
| 24 |
"""A unique key to reference the Feature Flag."""
|
| 25 |
name: str
|
| 26 |
"""A descriptive name for the Feature Flag."""
|
| 27 |
+
description: str | None
|
| 28 |
"""A description for the Feature Flag."""
|
| 29 |
+
owner: FlagCreatedDataOwner | None
|
| 30 |
"""The owner of the Feature Flag."""
|
| 31 |
+
tags: list[str]
|
| 32 |
"""Labels assigned to the Feature Flag for categorizing and filtering."""
|
| 33 |
enabled: bool
|
| 34 |
"""Specifies whether the Feature Flag is active for the current environment."""
|
|
|
|
| 40 |
"""An ISO 8601 timestamp."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagCreatedData:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
|
|
|
| 50 |
slug=data["slug"],
|
| 51 |
name=data["name"],
|
| 52 |
description=data["description"],
|
| 53 |
+
owner=FlagCreatedDataOwner.from_dict(cast(dict[str, Any], _v_owner))
|
| 54 |
if (_v_owner := data["owner"]) is not None
|
| 55 |
else None,
|
| 56 |
tags=data["tags"],
|
|
|
|
| 62 |
except (KeyError, ValueError) as e:
|
| 63 |
_raise_deserialize_error("FlagCreatedData", e)
|
| 64 |
|
| 65 |
+
def to_dict(self) -> dict[str, Any]:
|
| 66 |
"""Serialize to a dictionary."""
|
| 67 |
+
result: dict[str, Any] = {}
|
| 68 |
result["object"] = self.object
|
| 69 |
result["id"] = self.id
|
| 70 |
result["environment_id"] = self.environment_id
|
python/src/workos/common/models/flag_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .flag_deleted_context import FlagDeletedContext
|
| 13 |
from .flag_deleted_data import FlagDeletedData
|
|
@@ -22,33 +21,33 @@ class FlagDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["flag.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
"""Additional context about the event."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
object=data.get("object", "event"),
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "flag.deleted"),
|
| 40 |
-
data=FlagDeletedData.from_dict(cast(
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
context=FlagDeletedContext.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("FlagDeleted", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .flag_deleted_context import FlagDeletedContext
|
| 12 |
from .flag_deleted_data import FlagDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["flag.deleted"]
|
| 24 |
+
data: FlagDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: FlagDeletedContext
|
| 29 |
"""Additional context about the event."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagDeleted:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "flag.deleted"),
|
| 39 |
+
data=FlagDeletedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
context=FlagDeletedContext.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["context"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagDeleted", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
python/src/workos/common/models/flag_rule_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .flag_rule_updated_context import FlagRuleUpdatedContext
|
| 13 |
from .flag_rule_updated_data import FlagRuleUpdatedData
|
|
@@ -22,33 +21,33 @@ class FlagRuleUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["flag.rule_updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
"""Additional context about the event."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
object=data.get("object", "event"),
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "flag.rule_updated"),
|
| 40 |
-
data=FlagRuleUpdatedData.from_dict(cast(
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
context=FlagRuleUpdatedContext.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("FlagRuleUpdated", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .flag_rule_updated_context import FlagRuleUpdatedContext
|
| 12 |
from .flag_rule_updated_data import FlagRuleUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["flag.rule_updated"]
|
| 24 |
+
data: FlagRuleUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: FlagRuleUpdatedContext
|
| 29 |
"""Additional context about the event."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagRuleUpdated:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "flag.rule_updated"),
|
| 39 |
+
data=FlagRuleUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
context=FlagRuleUpdatedContext.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["context"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagRuleUpdated", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
python/src/workos/common/models/flag_rule_updated_context.py|
@@ -4,10 +4,11 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
|
|
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
|
|
|
| 11 |
from .flag_rule_updated_context_actor import FlagRuleUpdatedContextActor
|
| 12 |
from .flag_rule_updated_context_configured_target import (
|
| 13 |
FlagRuleUpdatedContextConfiguredTarget,
|
|
@@ -15,7 +16,6 @@ from .flag_rule_updated_context_configured_target import (
|
|
| 15 |
from .flag_rule_updated_context_previous_attribute import (
|
| 16 |
FlagRuleUpdatedContextPreviousAttribute,
|
| 17 |
)
|
| 18 |
-
from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType
|
| 19 |
|
| 20 |
|
| 21 |
@dataclass(slots=True)
|
|
@@ -24,38 +24,38 @@ class FlagRuleUpdatedContext:
|
|
| 24 |
|
| 25 |
client_id: str
|
| 26 |
"""The client ID associated with the flag event."""
|
| 27 |
-
actor:
|
| 28 |
"""The actor who performed the action."""
|
| 29 |
-
access_type:
|
| 30 |
"""The access type of the flag rule."""
|
| 31 |
-
configured_targets:
|
| 32 |
"""The configured targets for the flag rule."""
|
| 33 |
-
previous_attributes:
|
| 34 |
"""Attributes that changed from their previous values."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
-
def from_dict(cls, data:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
| 41 |
client_id=data["client_id"],
|
| 42 |
actor=FlagRuleUpdatedContextActor.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
access_type=FlagRuleUpdatedContextAccessType(data["access_type"]),
|
| 46 |
configured_targets=FlagRuleUpdatedContextConfiguredTarget.from_dict(
|
| 47 |
-
cast(
|
| 48 |
),
|
| 49 |
previous_attributes=FlagRuleUpdatedContextPreviousAttribute.from_dict(
|
| 50 |
-
cast(
|
| 51 |
),
|
| 52 |
)
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("FlagRuleUpdatedContext", e)
|
| 55 |
|
| 56 |
-
def to_dict(self) ->
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
-
result:
|
| 59 |
result["client_id"] = self.client_id
|
| 60 |
result["actor"] = self.actor.to_dict()
|
| 61 |
result["access_type"] = (
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
|
|
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
+
from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType
|
| 12 |
from .flag_rule_updated_context_actor import FlagRuleUpdatedContextActor
|
| 13 |
from .flag_rule_updated_context_configured_target import (
|
| 14 |
FlagRuleUpdatedContextConfiguredTarget,
|
|
|
|
| 16 |
from .flag_rule_updated_context_previous_attribute import (
|
| 17 |
FlagRuleUpdatedContextPreviousAttribute,
|
| 18 |
)
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
@dataclass(slots=True)
|
|
|
|
| 24 |
|
| 25 |
client_id: str
|
| 26 |
"""The client ID associated with the flag event."""
|
| 27 |
+
actor: FlagRuleUpdatedContextActor
|
| 28 |
"""The actor who performed the action."""
|
| 29 |
+
access_type: FlagRuleUpdatedContextAccessType
|
| 30 |
"""The access type of the flag rule."""
|
| 31 |
+
configured_targets: FlagRuleUpdatedContextConfiguredTarget
|
| 32 |
"""The configured targets for the flag rule."""
|
| 33 |
+
previous_attributes: FlagRuleUpdatedContextPreviousAttribute
|
| 34 |
"""Attributes that changed from their previous values."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagRuleUpdatedContext:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
| 41 |
client_id=data["client_id"],
|
| 42 |
actor=FlagRuleUpdatedContextActor.from_dict(
|
| 43 |
+
cast(dict[str, Any], data["actor"])
|
| 44 |
),
|
| 45 |
access_type=FlagRuleUpdatedContextAccessType(data["access_type"]),
|
| 46 |
configured_targets=FlagRuleUpdatedContextConfiguredTarget.from_dict(
|
| 47 |
+
cast(dict[str, Any], data["configured_targets"])
|
| 48 |
),
|
| 49 |
previous_attributes=FlagRuleUpdatedContextPreviousAttribute.from_dict(
|
| 50 |
+
cast(dict[str, Any], data["previous_attributes"])
|
| 51 |
),
|
| 52 |
)
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("FlagRuleUpdatedContext", e)
|
| 55 |
|
| 56 |
+
def to_dict(self) -> dict[str, Any]:
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
+
result: dict[str, Any] = {}
|
| 59 |
result["client_id"] = self.client_id
|
| 60 |
result["actor"] = self.actor.to_dict()
|
| 61 |
result["access_type"] = (
|
python/src/workos/common/models/flag_rule_updated_context_access_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class FlagRuleUpdatedContextAccessType(str, Enum):
|
|
| 17 |
ALL = "all"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
ALL = "all"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> FlagRuleUpdatedContextAccessType | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/flag_rule_updated_context_configured_target.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_rule_updated_context_configured_target_organization import (
|
|
@@ -19,27 +19,25 @@ from .flag_rule_updated_context_configured_target_user import (
|
|
| 19 |
class FlagRuleUpdatedContextConfiguredTarget:
|
| 20 |
"""The configured targets for the flag rule."""
|
| 21 |
|
| 22 |
-
organizations:
|
| 23 |
"""The organizations targeted by the flag rule."""
|
| 24 |
-
users:
|
| 25 |
"""The users targeted by the flag rule."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(
|
| 29 |
-
cls, data: Dict[str, Any]
|
| 30 |
-
) ->
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
| 34 |
organizations=[
|
| 35 |
FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(
|
| 36 |
-
cast(
|
| 37 |
)
|
| 38 |
for item in cast(list[Any], data["organizations"])
|
| 39 |
],
|
| 40 |
users=[
|
| 41 |
FlagRuleUpdatedContextConfiguredTargetUser.from_dict(
|
| 42 |
-
cast(
|
| 43 |
)
|
| 44 |
for item in cast(list[Any], data["users"])
|
| 45 |
],
|
|
@@ -47,9 +45,9 @@ class FlagRuleUpdatedContextConfiguredTarget:
|
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("FlagRuleUpdatedContextConfiguredTarget", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["organizations"] = [item.to_dict() for item in self.organizations]
|
| 54 |
result["users"] = [item.to_dict() for item in self.users]
|
| 55 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_rule_updated_context_configured_target_organization import (
|
|
|
|
| 19 |
class FlagRuleUpdatedContextConfiguredTarget:
|
| 20 |
"""The configured targets for the flag rule."""
|
| 21 |
|
| 22 |
+
organizations: list[FlagRuleUpdatedContextConfiguredTargetOrganization]
|
| 23 |
"""The organizations targeted by the flag rule."""
|
| 24 |
+
users: list[FlagRuleUpdatedContextConfiguredTargetUser]
|
| 25 |
"""The users targeted by the flag rule."""
|
| 26 |
|
| 27 |
@classmethod
|
|
|
|
|
|
|
| 28 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagRuleUpdatedContextConfiguredTarget:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
| 32 |
organizations=[
|
| 33 |
FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(
|
| 34 |
+
cast(dict[str, Any], item)
|
| 35 |
)
|
| 36 |
for item in cast(list[Any], data["organizations"])
|
| 37 |
],
|
| 38 |
users=[
|
| 39 |
FlagRuleUpdatedContextConfiguredTargetUser.from_dict(
|
| 40 |
+
cast(dict[str, Any], item)
|
| 41 |
)
|
| 42 |
for item in cast(list[Any], data["users"])
|
| 43 |
],
|
|
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagRuleUpdatedContextConfiguredTarget", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["organizations"] = [item.to_dict() for item in self.organizations]
|
| 52 |
result["users"] = [item.to_dict() for item in self.users]
|
| 53 |
return result
|
python/src/workos/common/models/flag_rule_updated_context_configured_target_user.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -18,8 +19,8 @@ class FlagRuleUpdatedContextConfiguredTargetUser:
|
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -29,9 +30,9 @@ class FlagRuleUpdatedContextConfiguredTargetUser:
|
|
| 29 |
except (KeyError, ValueError) as e:
|
| 30 |
_raise_deserialize_error("FlagRuleUpdatedContextConfiguredTargetUser", e)
|
| 31 |
|
| 32 |
-
def to_dict(self) ->
|
| 33 |
"""Serialize to a dictionary."""
|
| 34 |
-
result:
|
| 35 |
result["id"] = self.id
|
| 36 |
result["email"] = self.email
|
| 37 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> FlagRuleUpdatedContextConfiguredTargetUser:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("FlagRuleUpdatedContextConfiguredTargetUser", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
result["id"] = self.id
|
| 37 |
result["email"] = self.email
|
| 38 |
return result
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_rule_updated_context_previous_attribute_context import (
|
|
@@ -19,25 +19,23 @@ from .flag_rule_updated_context_previous_attribute_data import (
|
|
| 19 |
class FlagRuleUpdatedContextPreviousAttribute:
|
| 20 |
"""Attributes that changed from their previous values."""
|
| 21 |
|
| 22 |
-
data:
|
| 23 |
"""The previous data attributes of the flag."""
|
| 24 |
-
context:
|
| 25 |
"""The previous context attributes of the flag rule."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(
|
| 29 |
-
cls, data: Dict[str, Any]
|
| 30 |
-
) ->
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
| 34 |
data=FlagRuleUpdatedContextPreviousAttributeData.from_dict(
|
| 35 |
-
cast(
|
| 36 |
)
|
| 37 |
if (_v_data := data.get("data")) is not None
|
| 38 |
else None,
|
| 39 |
context=FlagRuleUpdatedContextPreviousAttributeContext.from_dict(
|
| 40 |
-
cast(
|
| 41 |
)
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
|
@@ -45,9 +43,9 @@ class FlagRuleUpdatedContextPreviousAttribute:
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagRuleUpdatedContextPreviousAttribute", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
if self.data is not None:
|
| 52 |
result["data"] = self.data.to_dict()
|
| 53 |
if self.context is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_rule_updated_context_previous_attribute_context import (
|
|
|
|
| 19 |
class FlagRuleUpdatedContextPreviousAttribute:
|
| 20 |
"""Attributes that changed from their previous values."""
|
| 21 |
|
| 22 |
+
data: FlagRuleUpdatedContextPreviousAttributeData | None = None
|
| 23 |
"""The previous data attributes of the flag."""
|
| 24 |
+
context: FlagRuleUpdatedContextPreviousAttributeContext | None = None
|
| 25 |
"""The previous context attributes of the flag rule."""
|
| 26 |
|
| 27 |
@classmethod
|
|
|
|
|
|
|
| 28 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagRuleUpdatedContextPreviousAttribute:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
| 32 |
data=FlagRuleUpdatedContextPreviousAttributeData.from_dict(
|
| 33 |
+
cast(dict[str, Any], _v_data)
|
| 34 |
)
|
| 35 |
if (_v_data := data.get("data")) is not None
|
| 36 |
else None,
|
| 37 |
context=FlagRuleUpdatedContextPreviousAttributeContext.from_dict(
|
| 38 |
+
cast(dict[str, Any], _v_context)
|
| 39 |
)
|
| 40 |
if (_v_context := data.get("context")) is not None
|
| 41 |
else None,
|
|
|
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("FlagRuleUpdatedContextPreviousAttribute", e)
|
| 45 |
|
| 46 |
+
def to_dict(self) -> dict[str, Any]:
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
+
result: dict[str, Any] = {}
|
| 49 |
if self.data is not None:
|
| 50 |
result["data"] = self.data.to_dict()
|
| 51 |
if self.context is not None:
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute_context.py|
@@ -4,35 +4,33 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
-
from .flag_rule_updated_context_previous_attribute_context_configured_target import (
|
| 12 |
-
FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget,
|
| 13 |
-
)
|
| 14 |
from .flag_rule_updated_context_previous_attribute_context_access_type import (
|
| 15 |
FlagRuleUpdatedContextPreviousAttributeContextAccessType,
|
| 16 |
)
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
@dataclass(slots=True)
|
| 20 |
class FlagRuleUpdatedContextPreviousAttributeContext:
|
| 21 |
"""The previous context attributes of the flag rule."""
|
| 22 |
|
| 23 |
-
access_type: Optional[
|
| 24 |
-
|
| 25 |
-
] = None
|
| 26 |
"""The previous access type of the flag rule."""
|
| 27 |
-
configured_targets:
|
| 28 |
-
|
| 29 |
-
|
| 30 |
"""The previous configured targets for the flag rule."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
-
cls, data:
|
| 35 |
-
) ->
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -42,7 +40,7 @@ class FlagRuleUpdatedContextPreviousAttributeContext:
|
|
| 42 |
if (_v_access_type := data.get("access_type")) is not None
|
| 43 |
else None,
|
| 44 |
configured_targets=FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(
|
| 45 |
-
cast(
|
| 46 |
)
|
| 47 |
if (_v_configured_targets := data.get("configured_targets")) is not None
|
| 48 |
else None,
|
|
@@ -52,9 +50,9 @@ class FlagRuleUpdatedContextPreviousAttributeContext:
|
|
| 52 |
"FlagRuleUpdatedContextPreviousAttributeContext", e
|
| 53 |
)
|
| 54 |
|
| 55 |
-
def to_dict(self) ->
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
-
result:
|
| 58 |
if self.access_type is not None:
|
| 59 |
result["access_type"] = (
|
| 60 |
self.access_type.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
from .flag_rule_updated_context_previous_attribute_context_access_type import (
|
| 12 |
FlagRuleUpdatedContextPreviousAttributeContextAccessType,
|
| 13 |
)
|
| 14 |
+
from .flag_rule_updated_context_previous_attribute_context_configured_target import (
|
| 15 |
+
FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget,
|
| 16 |
+
)
|
| 17 |
|
| 18 |
|
| 19 |
@dataclass(slots=True)
|
| 20 |
class FlagRuleUpdatedContextPreviousAttributeContext:
|
| 21 |
"""The previous context attributes of the flag rule."""
|
| 22 |
|
|
|
|
| 23 |
+
access_type: FlagRuleUpdatedContextPreviousAttributeContextAccessType | None = None
|
|
|
|
| 24 |
"""The previous access type of the flag rule."""
|
| 25 |
+
configured_targets: (
|
| 26 |
+
FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget | None
|
| 27 |
+
) = None
|
| 28 |
"""The previous configured targets for the flag rule."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
def from_dict(
|
| 32 |
+
cls, data: dict[str, Any]
|
| 33 |
+
) -> FlagRuleUpdatedContextPreviousAttributeContext:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 40 |
if (_v_access_type := data.get("access_type")) is not None
|
| 41 |
else None,
|
| 42 |
configured_targets=FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(
|
| 43 |
+
cast(dict[str, Any], _v_configured_targets)
|
| 44 |
)
|
| 45 |
if (_v_configured_targets := data.get("configured_targets")) is not None
|
| 46 |
else None,
|
|
|
|
| 50 |
"FlagRuleUpdatedContextPreviousAttributeContext", e
|
| 51 |
)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
if self.access_type is not None:
|
| 57 |
result["access_type"] = (
|
| 58 |
self.access_type.value
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_access_type.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType
|
| 5 |
|
| 6 |
FlagRuleUpdatedContextPreviousAttributeContextAccessType: TypeAlias = (
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType
|
| 6 |
|
| 7 |
FlagRuleUpdatedContextPreviousAttributeContextAccessType: TypeAlias = (
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .flag_rule_updated_context_configured_target import (
|
| 5 |
FlagRuleUpdatedContextConfiguredTarget,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .flag_rule_updated_context_configured_target import (
|
| 6 |
FlagRuleUpdatedContextConfiguredTarget,
|
| 7 |
)
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_user.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .flag_rule_updated_context_configured_target_user import (
|
| 5 |
FlagRuleUpdatedContextConfiguredTargetUser,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .flag_rule_updated_context_configured_target_user import (
|
| 6 |
FlagRuleUpdatedContextConfiguredTargetUser,
|
| 7 |
)
|
python/src/workos/common/models/flag_rule_updated_context_previous_attribute_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,15 +12,15 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class FlagRuleUpdatedContextPreviousAttributeData:
|
| 12 |
"""The previous data attributes of the flag."""
|
| 13 |
|
| 14 |
-
enabled:
|
| 15 |
"""Whether the flag was previously enabled."""
|
| 16 |
-
default_value:
|
| 17 |
"""The previous default value of the flag."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -29,9 +30,9 @@ class FlagRuleUpdatedContextPreviousAttributeData:
|
|
| 29 |
except (KeyError, ValueError) as e:
|
| 30 |
_raise_deserialize_error("FlagRuleUpdatedContextPreviousAttributeData", e)
|
| 31 |
|
| 32 |
-
def to_dict(self) ->
|
| 33 |
"""Serialize to a dictionary."""
|
| 34 |
-
result:
|
| 35 |
if self.enabled is not None:
|
| 36 |
result["enabled"] = self.enabled
|
| 37 |
if self.default_value is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class FlagRuleUpdatedContextPreviousAttributeData:
|
| 13 |
"""The previous data attributes of the flag."""
|
| 14 |
|
| 15 |
+
enabled: bool | None = None
|
| 16 |
"""Whether the flag was previously enabled."""
|
| 17 |
+
default_value: bool | None = None
|
| 18 |
"""The previous default value of the flag."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> FlagRuleUpdatedContextPreviousAttributeData:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("FlagRuleUpdatedContextPreviousAttributeData", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
if self.enabled is not None:
|
| 37 |
result["enabled"] = self.enabled
|
| 38 |
if self.default_value is not None:
|
python/src/workos/common/models/flag_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .flag_updated_context import FlagUpdatedContext
|
| 13 |
from .flag_updated_data import FlagUpdatedData
|
|
@@ -22,33 +21,33 @@ class FlagUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["flag.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
"""Additional context about the event."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
-
def from_dict(cls, data:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
| 37 |
object=data.get("object", "event"),
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "flag.updated"),
|
| 40 |
-
data=FlagUpdatedData.from_dict(cast(
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
context=FlagUpdatedContext.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("FlagUpdated", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .flag_updated_context import FlagUpdatedContext
|
| 12 |
from .flag_updated_data import FlagUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["flag.updated"]
|
| 24 |
+
data: FlagUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: FlagUpdatedContext
|
| 29 |
"""Additional context about the event."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagUpdated:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "flag.updated"),
|
| 39 |
+
data=FlagUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
context=FlagUpdatedContext.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["context"])
|
| 43 |
),
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("FlagUpdated", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
python/src/workos/common/models/flag_updated_context.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_updated_context_actor import FlagUpdatedContextActor
|
|
@@ -17,22 +17,22 @@ class FlagUpdatedContext:
|
|
| 17 |
|
| 18 |
client_id: str
|
| 19 |
"""The client ID associated with the flag event."""
|
| 20 |
-
actor:
|
| 21 |
"""The actor who performed the action."""
|
| 22 |
-
previous_attributes:
|
| 23 |
"""Attributes that changed from their previous values."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
client_id=data["client_id"],
|
| 31 |
actor=FlagUpdatedContextActor.from_dict(
|
| 32 |
-
cast(
|
| 33 |
),
|
| 34 |
previous_attributes=FlagUpdatedContextPreviousAttribute.from_dict(
|
| 35 |
-
cast(
|
| 36 |
)
|
| 37 |
if (_v_previous_attributes := data.get("previous_attributes"))
|
| 38 |
is not None
|
|
@@ -41,9 +41,9 @@ class FlagUpdatedContext:
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("FlagUpdatedContext", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
result["client_id"] = self.client_id
|
| 48 |
result["actor"] = self.actor.to_dict()
|
| 49 |
if self.previous_attributes is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_updated_context_actor import FlagUpdatedContextActor
|
|
|
|
| 17 |
|
| 18 |
client_id: str
|
| 19 |
"""The client ID associated with the flag event."""
|
| 20 |
+
actor: FlagUpdatedContextActor
|
| 21 |
"""The actor who performed the action."""
|
| 22 |
+
previous_attributes: FlagUpdatedContextPreviousAttribute | None = None
|
| 23 |
"""Attributes that changed from their previous values."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagUpdatedContext:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
client_id=data["client_id"],
|
| 31 |
actor=FlagUpdatedContextActor.from_dict(
|
| 32 |
+
cast(dict[str, Any], data["actor"])
|
| 33 |
),
|
| 34 |
previous_attributes=FlagUpdatedContextPreviousAttribute.from_dict(
|
| 35 |
+
cast(dict[str, Any], _v_previous_attributes)
|
| 36 |
)
|
| 37 |
if (_v_previous_attributes := data.get("previous_attributes"))
|
| 38 |
is not None
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("FlagUpdatedContext", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["client_id"] = self.client_id
|
| 48 |
result["actor"] = self.actor.to_dict()
|
| 49 |
if self.previous_attributes is not None:
|
python/src/workos/common/models/flag_updated_context_previous_attribute.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_updated_context_previous_attribute_data import (
|
|
@@ -16,16 +16,16 @@ from .flag_updated_context_previous_attribute_data import (
|
|
| 16 |
class FlagUpdatedContextPreviousAttribute:
|
| 17 |
"""Attributes that changed from their previous values."""
|
| 18 |
|
| 19 |
-
data:
|
| 20 |
"""The previous data attributes of the flag."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
data=FlagUpdatedContextPreviousAttributeData.from_dict(
|
| 28 |
-
cast(
|
| 29 |
)
|
| 30 |
if (_v_data := data.get("data")) is not None
|
| 31 |
else None,
|
|
@@ -33,9 +33,9 @@ class FlagUpdatedContextPreviousAttribute:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("FlagUpdatedContextPreviousAttribute", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
if self.data is not None:
|
| 40 |
result["data"] = self.data.to_dict()
|
| 41 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .flag_updated_context_previous_attribute_data import (
|
|
|
|
| 16 |
class FlagUpdatedContextPreviousAttribute:
|
| 17 |
"""Attributes that changed from their previous values."""
|
| 18 |
|
| 19 |
+
data: FlagUpdatedContextPreviousAttributeData | None = None
|
| 20 |
"""The previous data attributes of the flag."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagUpdatedContextPreviousAttribute:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
data=FlagUpdatedContextPreviousAttributeData.from_dict(
|
| 28 |
+
cast(dict[str, Any], _v_data)
|
| 29 |
)
|
| 30 |
if (_v_data := data.get("data")) is not None
|
| 31 |
else None,
|
|
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("FlagUpdatedContextPreviousAttribute", e)
|
| 35 |
|
| 36 |
+
def to_dict(self) -> dict[str, Any]:
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
+
result: dict[str, Any] = {}
|
| 39 |
if self.data is not None:
|
| 40 |
result["data"] = self.data.to_dict()
|
| 41 |
return result
|
python/src/workos/common/models/flag_updated_context_previous_attribute_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,21 +12,19 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class FlagUpdatedContextPreviousAttributeData:
|
| 12 |
"""The previous data attributes of the flag."""
|
| 13 |
|
| 14 |
-
name:
|
| 15 |
"""The previous name of the flag."""
|
| 16 |
-
description:
|
| 17 |
"""The previous description of the flag."""
|
| 18 |
-
tags:
|
| 19 |
"""The previous tags of the flag."""
|
| 20 |
-
enabled:
|
| 21 |
"""Whether the flag was previously enabled."""
|
| 22 |
-
default_value:
|
| 23 |
"""The previous default value of the flag."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(
|
| 27 |
-
cls, data: Dict[str, Any]
|
| 28 |
-
) ->
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -38,9 +37,9 @@ class FlagUpdatedContextPreviousAttributeData:
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("FlagUpdatedContextPreviousAttributeData", e)
|
| 40 |
|
| 41 |
-
def to_dict(self) ->
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
-
result:
|
| 44 |
if self.name is not None:
|
| 45 |
result["name"] = self.name
|
| 46 |
if self.description is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class FlagUpdatedContextPreviousAttributeData:
|
| 13 |
"""The previous data attributes of the flag."""
|
| 14 |
|
| 15 |
+
name: str | None = None
|
| 16 |
"""The previous name of the flag."""
|
| 17 |
+
description: str | None = None
|
| 18 |
"""The previous description of the flag."""
|
| 19 |
+
tags: list[str] | None = None
|
| 20 |
"""The previous tags of the flag."""
|
| 21 |
+
enabled: bool | None = None
|
| 22 |
"""Whether the flag was previously enabled."""
|
| 23 |
+
default_value: bool | None = None
|
| 24 |
"""The previous default value of the flag."""
|
| 25 |
|
| 26 |
@classmethod
|
|
|
|
|
|
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> FlagUpdatedContextPreviousAttributeData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("FlagUpdatedContextPreviousAttributeData", e)
|
| 39 |
|
| 40 |
+
def to_dict(self) -> dict[str, Any]:
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
+
result: dict[str, Any] = {}
|
| 43 |
if self.name is not None:
|
| 44 |
result["name"] = self.name
|
| 45 |
if self.description is not None:
|
python/src/workos/common/models/generate_link_intent.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -21,7 +20,7 @@ class GenerateLinkIntent(str, Enum):
|
|
| 21 |
BRING_YOUR_OWN_KEY = "bring_your_own_key"
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def _missing_(cls, value: object) ->
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
BRING_YOUR_OWN_KEY = "bring_your_own_key"
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def _missing_(cls, value: object) -> GenerateLinkIntent | None:
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/group.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -21,7 +21,7 @@ class Group:
|
|
| 21 |
"""The ID of the Organization the Group belongs to."""
|
| 22 |
name: str
|
| 23 |
"""The name of the Group."""
|
| 24 |
-
description:
|
| 25 |
"""An optional description of the Group."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
|
@@ -29,7 +29,7 @@ class Group:
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -44,9 +44,9 @@ class Group:
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("Group", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["organization_id"] = self.organization_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 21 |
"""The ID of the Organization the Group belongs to."""
|
| 22 |
name: str
|
| 23 |
"""The name of the Group."""
|
| 24 |
+
description: str | None
|
| 25 |
"""An optional description of the Group."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> Group:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("Group", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["organization_id"] = self.organization_id
|
python/src/workos/common/models/group_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .group import Group
|
|
@@ -22,32 +21,32 @@ class GroupCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["group.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "group.created"),
|
| 39 |
-
data=Group.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("GroupCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .group import Group
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["group.created"]
|
| 24 |
+
data: Group
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "group.created"),
|
| 38 |
+
data=Group.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("GroupCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/group_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .group import Group
|
|
@@ -22,32 +21,32 @@ class GroupDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["group.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "group.deleted"),
|
| 39 |
-
data=Group.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("GroupDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .group import Group
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["group.deleted"]
|
| 24 |
+
data: Group
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "group.deleted"),
|
| 38 |
+
data=Group.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("GroupDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/group_member_added.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .group_member_added_data import GroupMemberAddedData
|
|
@@ -22,32 +21,32 @@ class GroupMemberAdded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["group.member_added"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "group.member_added"),
|
| 39 |
-
data=GroupMemberAddedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("GroupMemberAdded", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .group_member_added_data import GroupMemberAddedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["group.member_added"]
|
| 24 |
+
data: GroupMemberAddedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupMemberAdded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "group.member_added"),
|
| 38 |
+
data=GroupMemberAddedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("GroupMemberAdded", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/group_member_added_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class GroupMemberAddedData:
|
|
| 17 |
"""The ID of the OrganizationMembership."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class GroupMemberAddedData:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("GroupMemberAddedData", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["group_id"] = self.group_id
|
| 34 |
result["organization_membership_id"] = self.organization_membership_id
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The ID of the OrganizationMembership."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupMemberAddedData:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("GroupMemberAddedData", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["group_id"] = self.group_id
|
| 35 |
result["organization_membership_id"] = self.organization_membership_id
|
| 36 |
return result
|
python/src/workos/common/models/group_member_removed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .group_member_removed_data import GroupMemberRemovedData
|
|
@@ -22,14 +21,14 @@ class GroupMemberRemoved:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["group.member_removed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class GroupMemberRemoved:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "group.member_removed"),
|
| 39 |
data=GroupMemberRemovedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("GroupMemberRemoved", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .group_member_removed_data import GroupMemberRemovedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["group.member_removed"]
|
| 24 |
+
data: GroupMemberRemovedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupMemberRemoved:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "group.member_removed"),
|
| 38 |
data=GroupMemberRemovedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("GroupMemberRemoved", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/group_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .group import Group
|
|
@@ -22,32 +21,32 @@ class GroupUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["group.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "group.updated"),
|
| 39 |
-
data=Group.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("GroupUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .group import Group
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["group.updated"]
|
| 24 |
+
data: Group
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> GroupUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "group.updated"),
|
| 38 |
+
data=Group.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("GroupUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/invitation_accepted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .invitation_accepted_data import InvitationAcceptedData
|
|
@@ -22,14 +21,14 @@ class InvitationAccepted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["invitation.accepted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class InvitationAccepted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "invitation.accepted"),
|
| 39 |
data=InvitationAcceptedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("InvitationAccepted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .invitation_accepted_data import InvitationAcceptedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["invitation.accepted"]
|
| 24 |
+
data: InvitationAcceptedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> InvitationAccepted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "invitation.accepted"),
|
| 38 |
data=InvitationAcceptedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("InvitationAccepted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/invitation_accepted_data.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .invitation_accepted_data_state import InvitationAcceptedDataState
|
| 12 |
|
| 13 |
|
|
@@ -21,21 +22,21 @@ class InvitationAcceptedData:
|
|
| 21 |
"""The unique ID of the invitation."""
|
| 22 |
email: str
|
| 23 |
"""The email address of the recipient."""
|
| 24 |
-
state:
|
| 25 |
"""The state of the invitation."""
|
| 26 |
-
accepted_at:
|
| 27 |
"""The timestamp when the invitation was accepted, or null if not yet accepted."""
|
| 28 |
-
revoked_at:
|
| 29 |
"""The timestamp when the invitation was revoked, or null if not revoked."""
|
| 30 |
expires_at: datetime
|
| 31 |
"""The timestamp when the invitation expires."""
|
| 32 |
-
organization_id:
|
| 33 |
"""The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join."""
|
| 34 |
-
inviter_user_id:
|
| 35 |
"""The ID of the user who invited the recipient, if provided."""
|
| 36 |
-
accepted_user_id:
|
| 37 |
"""The ID of the user who accepted the invitation, once accepted."""
|
| 38 |
-
role_slug:
|
| 39 |
"""Slug of the role the invitee will be assigned on acceptance. Reflects the current role on the invitee's organization membership. null when the invitation has no associated organization."""
|
| 40 |
created_at: datetime
|
| 41 |
"""An ISO 8601 timestamp."""
|
|
@@ -43,7 +44,7 @@ class InvitationAcceptedData:
|
|
| 43 |
"""An ISO 8601 timestamp."""
|
| 44 |
|
| 45 |
@classmethod
|
| 46 |
-
def from_dict(cls, data:
|
| 47 |
"""Deserialize from a dictionary."""
|
| 48 |
try:
|
| 49 |
return cls(
|
|
@@ -68,9 +69,9 @@ class InvitationAcceptedData:
|
|
| 68 |
except (KeyError, ValueError) as e:
|
| 69 |
_raise_deserialize_error("InvitationAcceptedData", e)
|
| 70 |
|
| 71 |
-
def to_dict(self) ->
|
| 72 |
"""Serialize to a dictionary."""
|
| 73 |
-
result:
|
| 74 |
result["object"] = self.object
|
| 75 |
result["id"] = self.id
|
| 76 |
result["email"] = self.email
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .invitation_accepted_data_state import InvitationAcceptedDataState
|
| 13 |
|
| 14 |
|
|
|
|
| 22 |
"""The unique ID of the invitation."""
|
| 23 |
email: str
|
| 24 |
"""The email address of the recipient."""
|
| 25 |
+
state: InvitationAcceptedDataState
|
| 26 |
"""The state of the invitation."""
|
| 27 |
+
accepted_at: datetime | None
|
| 28 |
"""The timestamp when the invitation was accepted, or null if not yet accepted."""
|
| 29 |
+
revoked_at: datetime | None
|
| 30 |
"""The timestamp when the invitation was revoked, or null if not revoked."""
|
| 31 |
expires_at: datetime
|
| 32 |
"""The timestamp when the invitation expires."""
|
| 33 |
+
organization_id: str | None
|
| 34 |
"""The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join."""
|
| 35 |
+
inviter_user_id: str | None
|
| 36 |
"""The ID of the user who invited the recipient, if provided."""
|
| 37 |
+
accepted_user_id: str | None
|
| 38 |
"""The ID of the user who accepted the invitation, once accepted."""
|
| 39 |
+
role_slug: str | None
|
| 40 |
"""Slug of the role the invitee will be assigned on acceptance. Reflects the current role on the invitee's organization membership. null when the invitation has no associated organization."""
|
| 41 |
created_at: datetime
|
| 42 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 44 |
"""An ISO 8601 timestamp."""
|
| 45 |
|
| 46 |
@classmethod
|
| 47 |
+
def from_dict(cls, data: dict[str, Any]) -> InvitationAcceptedData:
|
| 48 |
"""Deserialize from a dictionary."""
|
| 49 |
try:
|
| 50 |
return cls(
|
|
|
|
| 69 |
except (KeyError, ValueError) as e:
|
| 70 |
_raise_deserialize_error("InvitationAcceptedData", e)
|
| 71 |
|
| 72 |
+
def to_dict(self) -> dict[str, Any]:
|
| 73 |
"""Serialize to a dictionary."""
|
| 74 |
+
result: dict[str, Any] = {}
|
| 75 |
result["object"] = self.object
|
| 76 |
result["id"] = self.id
|
| 77 |
result["email"] = self.email
|
python/src/workos/common/models/invitation_accepted_data_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class InvitationAcceptedDataState(str, Enum):
|
|
| 18 |
REVOKED = "revoked"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def _missing_(cls, value: object) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
REVOKED = "revoked"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
+
def _missing_(cls, value: object) -> InvitationAcceptedDataState | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/invitation_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .invitation_created_data import InvitationCreatedData
|
|
@@ -22,14 +21,14 @@ class InvitationCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["invitation.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class InvitationCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "invitation.created"),
|
| 39 |
data=InvitationCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("InvitationCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .invitation_created_data import InvitationCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["invitation.created"]
|
| 24 |
+
data: InvitationCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> InvitationCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "invitation.created"),
|
| 38 |
data=InvitationCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("InvitationCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/invitation_resent.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .invitation_resent_data import InvitationResentData
|
|
@@ -22,32 +21,32 @@ class InvitationResent:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["invitation.resent"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "invitation.resent"),
|
| 39 |
-
data=InvitationResentData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("InvitationResent", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .invitation_resent_data import InvitationResentData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["invitation.resent"]
|
| 24 |
+
data: InvitationResentData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> InvitationResent:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "invitation.resent"),
|
| 38 |
+
data=InvitationResentData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("InvitationResent", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/invitation_revoked.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .invitation_revoked_data import InvitationRevokedData
|
|
@@ -22,14 +21,14 @@ class InvitationRevoked:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["invitation.revoked"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class InvitationRevoked:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "invitation.revoked"),
|
| 39 |
data=InvitationRevokedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("InvitationRevoked", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .invitation_revoked_data import InvitationRevokedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["invitation.revoked"]
|
| 24 |
+
data: InvitationRevokedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> InvitationRevoked:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "invitation.revoked"),
|
| 38 |
data=InvitationRevokedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("InvitationRevoked", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/list_metadata.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,13 +12,13 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class ListMetadata:
|
| 12 |
"""Cursor-based pagination metadata."""
|
| 13 |
|
| 14 |
-
after:
|
| 15 |
"""Cursor for the next page of results."""
|
| 16 |
-
before:
|
| 17 |
"""Cursor for the previous page of results."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class ListMetadata:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("ListMetadata", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
if self.after is not None:
|
| 34 |
result["after"] = self.after
|
| 35 |
else:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class ListMetadata:
|
| 13 |
"""Cursor-based pagination metadata."""
|
| 14 |
|
| 15 |
+
after: str | None = None
|
| 16 |
"""Cursor for the next page of results."""
|
| 17 |
+
before: str | None = None
|
| 18 |
"""Cursor for the previous page of results."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> ListMetadata:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("ListMetadata", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.after is not None:
|
| 35 |
result["after"] = self.after
|
| 36 |
else:
|
python/src/workos/common/models/magic_auth_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .magic_auth_created_data import MagicAuthCreatedData
|
|
@@ -22,32 +21,32 @@ class MagicAuthCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["magic_auth.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "magic_auth.created"),
|
| 39 |
-
data=MagicAuthCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("MagicAuthCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .magic_auth_created_data import MagicAuthCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["magic_auth.created"]
|
| 24 |
+
data: MagicAuthCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> MagicAuthCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "magic_auth.created"),
|
| 38 |
+
data=MagicAuthCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("MagicAuthCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/magic_auth_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -29,7 +29,7 @@ class MagicAuthCreatedData:
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -44,9 +44,9 @@ class MagicAuthCreatedData:
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("MagicAuthCreatedData", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["user_id"] = self.user_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> MagicAuthCreatedData:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("MagicAuthCreatedData", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/organization_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_created_data import OrganizationCreatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization.created"),
|
| 39 |
data=OrganizationCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_created_data import OrganizationCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization.created"]
|
| 24 |
+
data: OrganizationCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization.created"),
|
| 38 |
data=OrganizationCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_created_data.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .organization_created_data_domain import OrganizationCreatedDataDomain
|
| 13 |
|
|
@@ -22,21 +21,21 @@ class OrganizationCreatedData:
|
|
| 22 |
"""Unique identifier of the Organization."""
|
| 23 |
name: str
|
| 24 |
"""A descriptive name for the Organization. This field does not need to be unique."""
|
| 25 |
-
domains:
|
| 26 |
"""List of Organization Domains."""
|
| 27 |
-
metadata:
|
| 28 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 29 |
-
external_id:
|
| 30 |
"""The external ID of the Organization."""
|
| 31 |
created_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
updated_at: datetime
|
| 34 |
"""An ISO 8601 timestamp."""
|
| 35 |
-
stripe_customer_id:
|
| 36 |
"""The Stripe customer ID of the Organization."""
|
| 37 |
|
| 38 |
@classmethod
|
| 39 |
-
def from_dict(cls, data:
|
| 40 |
"""Deserialize from a dictionary."""
|
| 41 |
try:
|
| 42 |
return cls(
|
|
@@ -44,7 +43,7 @@ class OrganizationCreatedData:
|
|
| 44 |
id=data["id"],
|
| 45 |
name=data["name"],
|
| 46 |
domains=[
|
| 47 |
-
OrganizationCreatedDataDomain.from_dict(cast(
|
| 48 |
for item in cast(list[Any], data["domains"])
|
| 49 |
],
|
| 50 |
metadata=data["metadata"],
|
|
@@ -56,9 +55,9 @@ class OrganizationCreatedData:
|
|
| 56 |
except (KeyError, ValueError) as e:
|
| 57 |
_raise_deserialize_error("OrganizationCreatedData", e)
|
| 58 |
|
| 59 |
-
def to_dict(self) ->
|
| 60 |
"""Serialize to a dictionary."""
|
| 61 |
-
result:
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
| 64 |
result["name"] = self.name
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .organization_created_data_domain import OrganizationCreatedDataDomain
|
| 12 |
|
|
|
|
| 21 |
"""Unique identifier of the Organization."""
|
| 22 |
name: str
|
| 23 |
"""A descriptive name for the Organization. This field does not need to be unique."""
|
| 24 |
+
domains: list[OrganizationCreatedDataDomain]
|
| 25 |
"""List of Organization Domains."""
|
| 26 |
+
metadata: dict[str, str]
|
| 27 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 28 |
+
external_id: str | None
|
| 29 |
"""The external ID of the Organization."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
updated_at: datetime
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
+
stripe_customer_id: str | None = None
|
| 35 |
"""The Stripe customer ID of the Organization."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationCreatedData:
|
| 39 |
"""Deserialize from a dictionary."""
|
| 40 |
try:
|
| 41 |
return cls(
|
|
|
|
| 43 |
id=data["id"],
|
| 44 |
name=data["name"],
|
| 45 |
domains=[
|
| 46 |
+
OrganizationCreatedDataDomain.from_dict(cast(dict[str, Any], item))
|
| 47 |
for item in cast(list[Any], data["domains"])
|
| 48 |
],
|
| 49 |
metadata=data["metadata"],
|
|
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("OrganizationCreatedData", e)
|
| 57 |
|
| 58 |
+
def to_dict(self) -> dict[str, Any]:
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
+
result: dict[str, Any] = {}
|
| 61 |
result["object"] = self.object
|
| 62 |
result["id"] = self.id
|
| 63 |
result["name"] = self.name
|
python/src/workos/common/models/organization_created_data_domain_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -19,7 +18,7 @@ class OrganizationCreatedDataDomainState(str, Enum):
|
|
| 19 |
VERIFIED = "verified"
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def _missing_(cls, value: object) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
VERIFIED = "verified"
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def _missing_(cls, value: object) -> OrganizationCreatedDataDomainState | None:
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/organization_created_data_domain_verification_strategy.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class OrganizationCreatedDataDomainVerificationStrategy(str, Enum):
|
|
| 18 |
@classmethod
|
| 19 |
def _missing_(
|
| 20 |
cls, value: object
|
| 21 |
-
) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
@classmethod
|
| 18 |
def _missing_(
|
| 19 |
cls, value: object
|
| 20 |
+
) -> OrganizationCreatedDataDomainVerificationStrategy | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/organization_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_deleted_data import OrganizationDeletedData
|
|
@@ -22,14 +21,14 @@ class OrganizationDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization.deleted"),
|
| 39 |
data=OrganizationDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_deleted_data import OrganizationDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization.deleted"]
|
| 24 |
+
data: OrganizationDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization.deleted"),
|
| 38 |
data=OrganizationDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_deleted_data_domain_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .organization_domain_state import OrganizationDomainState
|
| 12 |
from .organization_domain_verification_strategy import (
|
| 13 |
OrganizationDomainVerificationStrategy,
|
|
@@ -30,17 +31,17 @@ class OrganizationDomain:
|
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
updated_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
-
state:
|
| 34 |
"""Verification state of the domain."""
|
| 35 |
-
verification_prefix:
|
| 36 |
"""The prefix used in DNS verification."""
|
| 37 |
-
verification_token:
|
| 38 |
"""Validation token to be used in DNS TXT record."""
|
| 39 |
-
verification_strategy:
|
| 40 |
"""Strategy used to verify the domain."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
-
def from_dict(cls, data:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
|
@@ -65,9 +66,9 @@ class OrganizationDomain:
|
|
| 65 |
except (KeyError, ValueError) as e:
|
| 66 |
_raise_deserialize_error("OrganizationDomain", e)
|
| 67 |
|
| 68 |
-
def to_dict(self) ->
|
| 69 |
"""Serialize to a dictionary."""
|
| 70 |
-
result:
|
| 71 |
result["object"] = self.object
|
| 72 |
result["id"] = self.id
|
| 73 |
result["organization_id"] = self.organization_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .organization_domain_state import OrganizationDomainState
|
| 13 |
from .organization_domain_verification_strategy import (
|
| 14 |
OrganizationDomainVerificationStrategy,
|
|
|
|
| 31 |
"""An ISO 8601 timestamp."""
|
| 32 |
updated_at: datetime
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
+
state: OrganizationDomainState | None = None
|
| 35 |
"""Verification state of the domain."""
|
| 36 |
+
verification_prefix: str | None = None
|
| 37 |
"""The prefix used in DNS verification."""
|
| 38 |
+
verification_token: str | None = None
|
| 39 |
"""Validation token to be used in DNS TXT record."""
|
| 40 |
+
verification_strategy: OrganizationDomainVerificationStrategy | None = None
|
| 41 |
"""Strategy used to verify the domain."""
|
| 42 |
|
| 43 |
@classmethod
|
| 44 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomain:
|
| 45 |
"""Deserialize from a dictionary."""
|
| 46 |
try:
|
| 47 |
return cls(
|
|
|
|
| 66 |
except (KeyError, ValueError) as e:
|
| 67 |
_raise_deserialize_error("OrganizationDomain", e)
|
| 68 |
|
| 69 |
+
def to_dict(self) -> dict[str, Any]:
|
| 70 |
"""Serialize to a dictionary."""
|
| 71 |
+
result: dict[str, Any] = {}
|
| 72 |
result["object"] = self.object
|
| 73 |
result["id"] = self.id
|
| 74 |
result["organization_id"] = self.organization_id
|
python/src/workos/common/models/organization_domain_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_domain_created_data import OrganizationDomainCreatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationDomainCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_domain.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationDomainCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_domain.created"),
|
| 39 |
data=OrganizationDomainCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationDomainCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_domain_created_data import OrganizationDomainCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_domain.created"]
|
| 24 |
+
data: OrganizationDomainCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_domain.created"),
|
| 38 |
data=OrganizationDomainCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationDomainCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_domain_created_data_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain_data_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class OrganizationDomainDataState(str, Enum):
|
|
| 16 |
VERIFIED = "verified"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
VERIFIED = "verified"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> OrganizationDomainDataState | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/organization_domain_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_domain_deleted_data import OrganizationDomainDeletedData
|
|
@@ -22,14 +21,14 @@ class OrganizationDomainDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_domain.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationDomainDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_domain.deleted"),
|
| 39 |
data=OrganizationDomainDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationDomainDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_domain_deleted_data import OrganizationDomainDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_domain.deleted"]
|
| 24 |
+
data: OrganizationDomainDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_domain.deleted"),
|
| 38 |
data=OrganizationDomainDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationDomainDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_domain_deleted_data_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_domain_updated_data import OrganizationDomainUpdatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationDomainUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_domain.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationDomainUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_domain.updated"),
|
| 39 |
data=OrganizationDomainUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationDomainUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_domain_updated_data import OrganizationDomainUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_domain.updated"]
|
| 24 |
+
data: OrganizationDomainUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_domain.updated"),
|
| 38 |
data=OrganizationDomainUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationDomainUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_domain_updated_data_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain_verification_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_domain_verification_failed_data import (
|
|
@@ -24,14 +23,14 @@ class OrganizationDomainVerificationFailed:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["organization_domain.verification_failed"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class OrganizationDomainVerificationFailed:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "organization_domain.verification_failed"),
|
| 41 |
data=OrganizationDomainVerificationFailedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("OrganizationDomainVerificationFailed", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_domain_verification_failed_data import (
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["organization_domain.verification_failed"]
|
| 26 |
+
data: OrganizationDomainVerificationFailedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainVerificationFailed:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "organization_domain.verification_failed"),
|
| 40 |
data=OrganizationDomainVerificationFailedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("OrganizationDomainVerificationFailed", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/organization_domain_verification_failed_data.py|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
|
|
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
from .organization_domain_verification_failed_data_organization_domain import (
|
|
@@ -20,29 +20,29 @@ from .organization_domain_verification_failed_data_reason import (
|
|
| 20 |
class OrganizationDomainVerificationFailedData:
|
| 21 |
"""The event payload."""
|
| 22 |
|
| 23 |
-
reason:
|
| 24 |
"""The reason the domain verification failed."""
|
| 25 |
-
organization_domain:
|
| 26 |
"""The organization domain that failed verification."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
def from_dict(
|
| 30 |
-
cls, data:
|
| 31 |
-
) ->
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
reason=OrganizationDomainVerificationFailedDataReason(data["reason"]),
|
| 36 |
organization_domain=OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
|
| 37 |
-
cast(
|
| 38 |
),
|
| 39 |
)
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("OrganizationDomainVerificationFailedData", e)
|
| 42 |
|
| 43 |
-
def to_dict(self) ->
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
-
result:
|
| 46 |
result["reason"] = (
|
| 47 |
self.reason.value if isinstance(self.reason, Enum) else self.reason
|
| 48 |
)
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
|
|
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
from .organization_domain_verification_failed_data_organization_domain import (
|
|
|
|
| 20 |
class OrganizationDomainVerificationFailedData:
|
| 21 |
"""The event payload."""
|
| 22 |
|
| 23 |
+
reason: OrganizationDomainVerificationFailedDataReason
|
| 24 |
"""The reason the domain verification failed."""
|
| 25 |
+
organization_domain: OrganizationDomainVerificationFailedDataOrganizationDomain
|
| 26 |
"""The organization domain that failed verification."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
def from_dict(
|
| 30 |
+
cls, data: dict[str, Any]
|
| 31 |
+
) -> OrganizationDomainVerificationFailedData:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
reason=OrganizationDomainVerificationFailedDataReason(data["reason"]),
|
| 36 |
organization_domain=OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(
|
| 37 |
+
cast(dict[str, Any], data["organization_domain"])
|
| 38 |
),
|
| 39 |
)
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("OrganizationDomainVerificationFailedData", e)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["reason"] = (
|
| 47 |
self.reason.value if isinstance(self.reason, Enum) else self.reason
|
| 48 |
)
|
python/src/workos/common/models/organization_domain_verification_failed_data_organization_domain.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_domain import OrganizationDomain
|
| 5 |
|
| 6 |
OrganizationDomainVerificationFailedDataOrganizationDomain: TypeAlias = (
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_domain import OrganizationDomain
|
| 6 |
|
| 7 |
OrganizationDomainVerificationFailedDataOrganizationDomain: TypeAlias = (
|
python/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_state.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_state import OrganizationCreatedDataDomainState
|
| 5 |
|
| 6 |
OrganizationDomainVerificationFailedDataOrganizationDomainState: TypeAlias = (
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_state import OrganizationCreatedDataDomainState
|
| 6 |
|
| 7 |
OrganizationDomainVerificationFailedDataOrganizationDomainState: TypeAlias = (
|
python/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain_verification_failed_data_reason.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -18,7 +17,7 @@ class OrganizationDomainVerificationFailedDataReason(str, Enum):
|
|
| 18 |
@classmethod
|
| 19 |
def _missing_(
|
| 20 |
cls, value: object
|
| 21 |
-
) ->
|
| 22 |
if not isinstance(value, str):
|
| 23 |
return None
|
| 24 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
@classmethod
|
| 18 |
def _missing_(
|
| 19 |
cls, value: object
|
| 20 |
+
) -> OrganizationDomainVerificationFailedDataReason | None:
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/organization_domain_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_domain_verified.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_domain_verified_data import OrganizationDomainVerifiedData
|
|
@@ -22,14 +21,14 @@ class OrganizationDomainVerified:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_domain.verified"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationDomainVerified:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_domain.verified"),
|
| 39 |
data=OrganizationDomainVerifiedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationDomainVerified", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_domain_verified_data import OrganizationDomainVerifiedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_domain.verified"]
|
| 24 |
+
data: OrganizationDomainVerifiedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainVerified:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_domain.verified"),
|
| 38 |
data=OrganizationDomainVerifiedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationDomainVerified", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_domain_verified_data_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/organization_membership_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_membership_created_data import OrganizationMembershipCreatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationMembershipCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_membership.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationMembershipCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_membership.created"),
|
| 39 |
data=OrganizationMembershipCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationMembershipCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_membership_created_data import OrganizationMembershipCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_membership.created"]
|
| 24 |
+
data: OrganizationMembershipCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationMembershipCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_membership.created"),
|
| 38 |
data=OrganizationMembershipCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationMembershipCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_membership_created_data.py|
@@ -5,15 +5,14 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
-
from .slim_role import SlimRole
|
| 14 |
from .organization_membership_created_data_status import (
|
| 15 |
OrganizationMembershipCreatedDataStatus,
|
| 16 |
)
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
@dataclass(slots=True)
|
|
@@ -28,11 +27,11 @@ class OrganizationMembershipCreatedData:
|
|
| 28 |
"""The ID of the user."""
|
| 29 |
organization_id: str
|
| 30 |
"""The ID of the organization."""
|
| 31 |
-
status:
|
| 32 |
"""The status of the organization membership."""
|
| 33 |
-
role:
|
| 34 |
"""The role associated with the membership."""
|
| 35 |
-
custom_attributes:
|
| 36 |
"""Custom attributes associated with the membership."""
|
| 37 |
directory_managed: bool
|
| 38 |
"""Whether the membership is managed by a directory sync provider."""
|
|
@@ -40,11 +39,11 @@ class OrganizationMembershipCreatedData:
|
|
| 40 |
"""An ISO 8601 timestamp."""
|
| 41 |
updated_at: datetime
|
| 42 |
"""An ISO 8601 timestamp."""
|
| 43 |
-
roles:
|
| 44 |
"""The roles associated with the membership."""
|
| 45 |
|
| 46 |
@classmethod
|
| 47 |
-
def from_dict(cls, data:
|
| 48 |
"""Deserialize from a dictionary."""
|
| 49 |
try:
|
| 50 |
return cls(
|
|
@@ -53,13 +52,13 @@ class OrganizationMembershipCreatedData:
|
|
| 53 |
user_id=data["user_id"],
|
| 54 |
organization_id=data["organization_id"],
|
| 55 |
status=OrganizationMembershipCreatedDataStatus(data["status"]),
|
| 56 |
-
role=SlimRole.from_dict(cast(
|
| 57 |
custom_attributes=data["custom_attributes"],
|
| 58 |
directory_managed=data["directory_managed"],
|
| 59 |
created_at=_parse_datetime(data["created_at"]),
|
| 60 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 61 |
roles=[
|
| 62 |
-
SlimRole.from_dict(cast(
|
| 63 |
for item in cast(list[Any], _v_roles)
|
| 64 |
]
|
| 65 |
if (_v_roles := data.get("roles")) is not None
|
|
@@ -68,9 +67,9 @@ class OrganizationMembershipCreatedData:
|
|
| 68 |
except (KeyError, ValueError) as e:
|
| 69 |
_raise_deserialize_error("OrganizationMembershipCreatedData", e)
|
| 70 |
|
| 71 |
-
def to_dict(self) ->
|
| 72 |
"""Serialize to a dictionary."""
|
| 73 |
-
result:
|
| 74 |
result["object"] = self.object
|
| 75 |
result["id"] = self.id
|
| 76 |
result["user_id"] = self.user_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
|
|
|
| 12 |
from .organization_membership_created_data_status import (
|
| 13 |
OrganizationMembershipCreatedDataStatus,
|
| 14 |
)
|
| 15 |
+
from .slim_role import SlimRole
|
| 16 |
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
|
|
|
| 27 |
"""The ID of the user."""
|
| 28 |
organization_id: str
|
| 29 |
"""The ID of the organization."""
|
| 30 |
+
status: OrganizationMembershipCreatedDataStatus
|
| 31 |
"""The status of the organization membership."""
|
| 32 |
+
role: SlimRole
|
| 33 |
"""The role associated with the membership."""
|
| 34 |
+
custom_attributes: dict[str, Any]
|
| 35 |
"""Custom attributes associated with the membership."""
|
| 36 |
directory_managed: bool
|
| 37 |
"""Whether the membership is managed by a directory sync provider."""
|
|
|
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
updated_at: datetime
|
| 41 |
"""An ISO 8601 timestamp."""
|
| 42 |
+
roles: list[SlimRole] | None = None
|
| 43 |
"""The roles associated with the membership."""
|
| 44 |
|
| 45 |
@classmethod
|
| 46 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationMembershipCreatedData:
|
| 47 |
"""Deserialize from a dictionary."""
|
| 48 |
try:
|
| 49 |
return cls(
|
|
|
|
| 52 |
user_id=data["user_id"],
|
| 53 |
organization_id=data["organization_id"],
|
| 54 |
status=OrganizationMembershipCreatedDataStatus(data["status"]),
|
| 55 |
+
role=SlimRole.from_dict(cast(dict[str, Any], data["role"])),
|
| 56 |
custom_attributes=data["custom_attributes"],
|
| 57 |
directory_managed=data["directory_managed"],
|
| 58 |
created_at=_parse_datetime(data["created_at"]),
|
| 59 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 60 |
roles=[
|
| 61 |
+
SlimRole.from_dict(cast(dict[str, Any], item))
|
| 62 |
for item in cast(list[Any], _v_roles)
|
| 63 |
]
|
| 64 |
if (_v_roles := data.get("roles")) is not None
|
|
|
|
| 67 |
except (KeyError, ValueError) as e:
|
| 68 |
_raise_deserialize_error("OrganizationMembershipCreatedData", e)
|
| 69 |
|
| 70 |
+
def to_dict(self) -> dict[str, Any]:
|
| 71 |
"""Serialize to a dictionary."""
|
| 72 |
+
result: dict[str, Any] = {}
|
| 73 |
result["object"] = self.object
|
| 74 |
result["id"] = self.id
|
| 75 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/organization_membership_created_data_status.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,9 +16,7 @@ class OrganizationMembershipCreatedDataStatus(str, Enum):
|
|
| 17 |
PENDING = "pending"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(
|
| 21 |
-
cls, value: object
|
| 22 |
-
) ->
|
| 23 |
if not isinstance(value, str):
|
| 24 |
return None
|
| 25 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
PENDING = "pending"
|
| 17 |
|
| 18 |
@classmethod
|
|
|
|
|
|
|
| 19 |
+
def _missing_(cls, value: object) -> OrganizationMembershipCreatedDataStatus | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/organization_membership_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_membership_deleted_data import OrganizationMembershipDeletedData
|
|
@@ -22,14 +21,14 @@ class OrganizationMembershipDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_membership.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationMembershipDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_membership.deleted"),
|
| 39 |
data=OrganizationMembershipDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationMembershipDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_membership_deleted_data import OrganizationMembershipDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_membership.deleted"]
|
| 24 |
+
data: OrganizationMembershipDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationMembershipDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_membership.deleted"),
|
| 38 |
data=OrganizationMembershipDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationMembershipDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_membership_deleted_data_status.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_membership_created_data_status import (
|
| 5 |
OrganizationMembershipCreatedDataStatus,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_membership_created_data_status import (
|
| 6 |
OrganizationMembershipCreatedDataStatus,
|
| 7 |
)
|
python/src/workos/common/models/organization_membership_status.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_membership_created_data_status import (
|
| 5 |
OrganizationMembershipCreatedDataStatus,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_membership_created_data_status import (
|
| 6 |
OrganizationMembershipCreatedDataStatus,
|
| 7 |
)
|
python/src/workos/common/models/organization_membership_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_membership_updated_data import OrganizationMembershipUpdatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationMembershipUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_membership.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationMembershipUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_membership.updated"),
|
| 39 |
data=OrganizationMembershipUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationMembershipUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_membership_updated_data import OrganizationMembershipUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_membership.updated"]
|
| 24 |
+
data: OrganizationMembershipUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationMembershipUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_membership.updated"),
|
| 38 |
data=OrganizationMembershipUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationMembershipUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_membership_updated_data_status.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_membership_created_data_status import (
|
| 5 |
OrganizationMembershipCreatedDataStatus,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_membership_created_data_status import (
|
| 6 |
OrganizationMembershipCreatedDataStatus,
|
| 7 |
)
|
python/src/workos/common/models/organization_role_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_role_created_data import OrganizationRoleCreatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationRoleCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_role.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationRoleCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_role.created"),
|
| 39 |
data=OrganizationRoleCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationRoleCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_role_created_data import OrganizationRoleCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_role.created"]
|
| 24 |
+
data: OrganizationRoleCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationRoleCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_role.created"),
|
| 38 |
data=OrganizationRoleCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationRoleCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_role_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -21,11 +21,11 @@ class OrganizationRoleCreatedData:
|
|
| 21 |
"""The slug identifier of the role."""
|
| 22 |
name: str
|
| 23 |
"""The name of the role."""
|
| 24 |
-
description:
|
| 25 |
"""A description of the role."""
|
| 26 |
resource_type_slug: str
|
| 27 |
"""The slug of the resource type the role applies to."""
|
| 28 |
-
permissions:
|
| 29 |
"""The permissions granted by the role."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
@@ -33,7 +33,7 @@ class OrganizationRoleCreatedData:
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -50,9 +50,9 @@ class OrganizationRoleCreatedData:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("OrganizationRoleCreatedData", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["organization_id"] = self.organization_id
|
| 58 |
result["slug"] = self.slug
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 21 |
"""The slug identifier of the role."""
|
| 22 |
name: str
|
| 23 |
"""The name of the role."""
|
| 24 |
+
description: str | None
|
| 25 |
"""A description of the role."""
|
| 26 |
resource_type_slug: str
|
| 27 |
"""The slug of the resource type the role applies to."""
|
| 28 |
+
permissions: list[str]
|
| 29 |
"""The permissions granted by the role."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationRoleCreatedData:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("OrganizationRoleCreatedData", e)
|
| 52 |
|
| 53 |
+
def to_dict(self) -> dict[str, Any]:
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
+
result: dict[str, Any] = {}
|
| 56 |
result["object"] = self.object
|
| 57 |
result["organization_id"] = self.organization_id
|
| 58 |
result["slug"] = self.slug
|
python/src/workos/common/models/organization_role_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_role_deleted_data import OrganizationRoleDeletedData
|
|
@@ -22,14 +21,14 @@ class OrganizationRoleDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_role.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationRoleDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_role.deleted"),
|
| 39 |
data=OrganizationRoleDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationRoleDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_role_deleted_data import OrganizationRoleDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_role.deleted"]
|
| 24 |
+
data: OrganizationRoleDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationRoleDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_role.deleted"),
|
| 38 |
data=OrganizationRoleDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationRoleDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_role_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_role_updated_data import OrganizationRoleUpdatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationRoleUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization_role.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationRoleUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization_role.updated"),
|
| 39 |
data=OrganizationRoleUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationRoleUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_role_updated_data import OrganizationRoleUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization_role.updated"]
|
| 24 |
+
data: OrganizationRoleUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationRoleUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization_role.updated"),
|
| 38 |
data=OrganizationRoleUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationRoleUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .organization_updated_data import OrganizationUpdatedData
|
|
@@ -22,14 +21,14 @@ class OrganizationUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["organization.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class OrganizationUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "organization.updated"),
|
| 39 |
data=OrganizationUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("OrganizationUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .organization_updated_data import OrganizationUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["organization.updated"]
|
| 24 |
+
data: OrganizationUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "organization.updated"),
|
| 38 |
data=OrganizationUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("OrganizationUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/organization_updated_data_domain_verification_strategy.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_created_data_domain_verification_strategy import (
|
| 5 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_created_data_domain_verification_strategy import (
|
| 6 |
OrganizationCreatedDataDomainVerificationStrategy,
|
| 7 |
)
|
python/src/workos/common/models/password_reset_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .password_reset_created_data import PasswordResetCreatedData
|
|
@@ -22,14 +21,14 @@ class PasswordResetCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["password_reset.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class PasswordResetCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "password_reset.created"),
|
| 39 |
data=PasswordResetCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("PasswordResetCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .password_reset_created_data import PasswordResetCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["password_reset.created"]
|
| 24 |
+
data: PasswordResetCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PasswordResetCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "password_reset.created"),
|
| 38 |
data=PasswordResetCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("PasswordResetCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/password_reset_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -27,7 +27,7 @@ class PasswordResetCreatedData:
|
|
| 27 |
"""The timestamp when the password reset token was created."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -41,9 +41,9 @@ class PasswordResetCreatedData:
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("PasswordResetCreatedData", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
result["object"] = self.object
|
| 48 |
result["id"] = self.id
|
| 49 |
result["user_id"] = self.user_id
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 27 |
"""The timestamp when the password reset token was created."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> PasswordResetCreatedData:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("PasswordResetCreatedData", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["object"] = self.object
|
| 48 |
result["id"] = self.id
|
| 49 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/password_reset_succeeded.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .password_reset_succeeded_data import PasswordResetSucceededData
|
|
@@ -22,14 +21,14 @@ class PasswordResetSucceeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["password_reset.succeeded"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class PasswordResetSucceeded:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "password_reset.succeeded"),
|
| 39 |
data=PasswordResetSucceededData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("PasswordResetSucceeded", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .password_reset_succeeded_data import PasswordResetSucceededData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["password_reset.succeeded"]
|
| 24 |
+
data: PasswordResetSucceededData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PasswordResetSucceeded:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "password_reset.succeeded"),
|
| 38 |
data=PasswordResetSucceededData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("PasswordResetSucceeded", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/permission_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .permission_created_data import PermissionCreatedData
|
|
@@ -22,14 +21,14 @@ class PermissionCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["permission.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class PermissionCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "permission.created"),
|
| 39 |
data=PermissionCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("PermissionCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .permission_created_data import PermissionCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["permission.created"]
|
| 24 |
+
data: PermissionCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PermissionCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "permission.created"),
|
| 38 |
data=PermissionCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("PermissionCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/permission_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .permission_deleted_data import PermissionDeletedData
|
|
@@ -22,14 +21,14 @@ class PermissionDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["permission.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class PermissionDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "permission.deleted"),
|
| 39 |
data=PermissionDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("PermissionDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .permission_deleted_data import PermissionDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["permission.deleted"]
|
| 24 |
+
data: PermissionDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PermissionDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "permission.deleted"),
|
| 38 |
data=PermissionDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("PermissionDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/permission_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .permission_updated_data import PermissionUpdatedData
|
|
@@ -22,14 +21,14 @@ class PermissionUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["permission.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class PermissionUpdated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "permission.updated"),
|
| 39 |
data=PermissionUpdatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("PermissionUpdated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .permission_updated_data import PermissionUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["permission.updated"]
|
| 24 |
+
data: PermissionUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PermissionUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "permission.updated"),
|
| 38 |
data=PermissionUpdatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("PermissionUpdated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/pipe_connected_account.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .pipe_connected_account_state import PipeConnectedAccountState
|
| 12 |
|
| 13 |
|
|
@@ -23,13 +24,13 @@ class PipeConnectedAccount:
|
|
| 23 |
"""The unique ID of the data integration."""
|
| 24 |
provider_slug: str
|
| 25 |
"""The provider slug for this connected account."""
|
| 26 |
-
user_id:
|
| 27 |
"""The ID of the User the connected account belongs to."""
|
| 28 |
-
organization_id:
|
| 29 |
"""The ID of the Organization the connected account belongs to."""
|
| 30 |
-
scopes:
|
| 31 |
"""The OAuth scopes granted for this connected account."""
|
| 32 |
-
state:
|
| 33 |
"""The state of the connected account."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
|
@@ -37,7 +38,7 @@ class PipeConnectedAccount:
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
|
| 39 |
@classmethod
|
| 40 |
-
def from_dict(cls, data:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
@@ -55,9 +56,9 @@ class PipeConnectedAccount:
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("PipeConnectedAccount", e)
|
| 57 |
|
| 58 |
-
def to_dict(self) ->
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
-
result:
|
| 61 |
result["object"] = self.object
|
| 62 |
result["id"] = self.id
|
| 63 |
result["data_integration_id"] = self.data_integration_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .pipe_connected_account_state import PipeConnectedAccountState
|
| 13 |
|
| 14 |
|
|
|
|
| 24 |
"""The unique ID of the data integration."""
|
| 25 |
provider_slug: str
|
| 26 |
"""The provider slug for this connected account."""
|
| 27 |
+
user_id: str | None
|
| 28 |
"""The ID of the User the connected account belongs to."""
|
| 29 |
+
organization_id: str | None
|
| 30 |
"""The ID of the Organization the connected account belongs to."""
|
| 31 |
+
scopes: list[str]
|
| 32 |
"""The OAuth scopes granted for this connected account."""
|
| 33 |
+
state: PipeConnectedAccountState
|
| 34 |
"""The state of the connected account."""
|
| 35 |
created_at: datetime
|
| 36 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
+
def from_dict(cls, data: dict[str, Any]) -> PipeConnectedAccount:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
return cls(
|
|
|
|
| 56 |
except (KeyError, ValueError) as e:
|
| 57 |
_raise_deserialize_error("PipeConnectedAccount", e)
|
| 58 |
|
| 59 |
+
def to_dict(self) -> dict[str, Any]:
|
| 60 |
"""Serialize to a dictionary."""
|
| 61 |
+
result: dict[str, Any] = {}
|
| 62 |
result["object"] = self.object
|
| 63 |
result["id"] = self.id
|
| 64 |
result["data_integration_id"] = self.data_integration_id
|
python/src/workos/common/models/pipes_connected_account_connected.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .pipe_connected_account import PipeConnectedAccount
|
|
@@ -22,32 +21,32 @@ class PipesConnectedAccountConnected:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["pipes.connected_account.connected"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "pipes.connected_account.connected"),
|
| 39 |
-
data=PipeConnectedAccount.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("PipesConnectedAccountConnected", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .pipe_connected_account import PipeConnectedAccount
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["pipes.connected_account.connected"]
|
| 24 |
+
data: PipeConnectedAccount
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PipesConnectedAccountConnected:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "pipes.connected_account.connected"),
|
| 38 |
+
data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("PipesConnectedAccountConnected", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/pipes_connected_account_connection_failed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .pipes_connected_account_connection_failed_data import (
|
|
@@ -24,14 +23,14 @@ class PipesConnectedAccountConnectionFailed:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["pipes.connected_account.connection_failed"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class PipesConnectedAccountConnectionFailed:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "pipes.connected_account.connection_failed"),
|
| 41 |
data=PipesConnectedAccountConnectionFailedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("PipesConnectedAccountConnectionFailed", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .pipes_connected_account_connection_failed_data import (
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["pipes.connected_account.connection_failed"]
|
| 26 |
+
data: PipesConnectedAccountConnectionFailedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> PipesConnectedAccountConnectionFailed:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "pipes.connected_account.connection_failed"),
|
| 40 |
data=PipesConnectedAccountConnectionFailedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("PipesConnectedAccountConnectionFailed", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/pipes_connected_account_connection_failed_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -19,25 +19,25 @@ class PipesConnectedAccountConnectionFailedData:
|
|
| 19 |
"""The unique ID of the data integration."""
|
| 20 |
provider_slug: str
|
| 21 |
"""The provider slug for this connection attempt."""
|
| 22 |
-
user_id:
|
| 23 |
"""The ID of the User the connection attempt belongs to."""
|
| 24 |
-
organization_id:
|
| 25 |
"""The ID of the Organization the connection attempt belongs to."""
|
| 26 |
error_code: str
|
| 27 |
"""A machine-readable error code for the failure."""
|
| 28 |
-
error_reason:
|
| 29 |
"""A human-readable explanation of the failure."""
|
| 30 |
-
provider_error:
|
| 31 |
"""The raw error code returned by the OAuth provider."""
|
| 32 |
-
provider_error_description:
|
| 33 |
"""The raw error description returned by the OAuth provider."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
def from_dict(
|
| 39 |
-
cls, data:
|
| 40 |
-
) ->
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
@@ -55,9 +55,9 @@ class PipesConnectedAccountConnectionFailedData:
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("PipesConnectedAccountConnectionFailedData", e)
|
| 57 |
|
| 58 |
-
def to_dict(self) ->
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
-
result:
|
| 61 |
result["object"] = self.object
|
| 62 |
result["data_integration_id"] = self.data_integration_id
|
| 63 |
result["provider_slug"] = self.provider_slug
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 19 |
"""The unique ID of the data integration."""
|
| 20 |
provider_slug: str
|
| 21 |
"""The provider slug for this connection attempt."""
|
| 22 |
+
user_id: str | None
|
| 23 |
"""The ID of the User the connection attempt belongs to."""
|
| 24 |
+
organization_id: str | None
|
| 25 |
"""The ID of the Organization the connection attempt belongs to."""
|
| 26 |
error_code: str
|
| 27 |
"""A machine-readable error code for the failure."""
|
| 28 |
+
error_reason: str | None
|
| 29 |
"""A human-readable explanation of the failure."""
|
| 30 |
+
provider_error: str | None
|
| 31 |
"""The raw error code returned by the OAuth provider."""
|
| 32 |
+
provider_error_description: str | None
|
| 33 |
"""The raw error description returned by the OAuth provider."""
|
| 34 |
created_at: datetime
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
|
| 37 |
@classmethod
|
| 38 |
def from_dict(
|
| 39 |
+
cls, data: dict[str, Any]
|
| 40 |
+
) -> PipesConnectedAccountConnectionFailedData:
|
| 41 |
"""Deserialize from a dictionary."""
|
| 42 |
try:
|
| 43 |
return cls(
|
|
|
|
| 55 |
except (KeyError, ValueError) as e:
|
| 56 |
_raise_deserialize_error("PipesConnectedAccountConnectionFailedData", e)
|
| 57 |
|
| 58 |
+
def to_dict(self) -> dict[str, Any]:
|
| 59 |
"""Serialize to a dictionary."""
|
| 60 |
+
result: dict[str, Any] = {}
|
| 61 |
result["object"] = self.object
|
| 62 |
result["data_integration_id"] = self.data_integration_id
|
| 63 |
result["provider_slug"] = self.provider_slug
|
python/src/workos/common/models/pipes_connected_account_disconnected.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .pipe_connected_account import PipeConnectedAccount
|
|
@@ -22,32 +21,32 @@ class PipesConnectedAccountDisconnected:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["pipes.connected_account.disconnected"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "pipes.connected_account.disconnected"),
|
| 39 |
-
data=PipeConnectedAccount.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("PipesConnectedAccountDisconnected", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .pipe_connected_account import PipeConnectedAccount
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["pipes.connected_account.disconnected"]
|
| 24 |
+
data: PipeConnectedAccount
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> PipesConnectedAccountDisconnected:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "pipes.connected_account.disconnected"),
|
| 38 |
+
data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("PipesConnectedAccountDisconnected", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/pipes_connected_account_reauthorization_needed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .pipe_connected_account import PipeConnectedAccount
|
|
@@ -22,16 +21,16 @@ class PipesConnectedAccountReauthorizationNeeded:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["pipes.connected_account.reauthorization_needed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
def from_dict(
|
| 33 |
-
cls, data:
|
| 34 |
-
) ->
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -40,18 +39,18 @@ class PipesConnectedAccountReauthorizationNeeded:
|
|
| 40 |
event=data.get(
|
| 41 |
"event", "pipes.connected_account.reauthorization_needed"
|
| 42 |
),
|
| 43 |
-
data=PipeConnectedAccount.from_dict(cast(
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("PipesConnectedAccountReauthorizationNeeded", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .pipe_connected_account import PipeConnectedAccount
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["pipes.connected_account.reauthorization_needed"]
|
| 24 |
+
data: PipeConnectedAccount
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
def from_dict(
|
| 32 |
+
cls, data: dict[str, Any]
|
| 33 |
+
) -> PipesConnectedAccountReauthorizationNeeded:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 39 |
event=data.get(
|
| 40 |
"event", "pipes.connected_account.reauthorization_needed"
|
| 41 |
),
|
| 42 |
+
data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("PipesConnectedAccountReauthorizationNeeded", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/radar_challenge_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .radar_challenge_created_data import RadarChallengeCreatedData
|
|
@@ -22,14 +21,14 @@ class RadarChallengeCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["radar.challenge_created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class RadarChallengeCreated:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "radar.challenge_created"),
|
| 39 |
data=RadarChallengeCreatedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("RadarChallengeCreated", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .radar_challenge_created_data import RadarChallengeCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["radar.challenge_created"]
|
| 24 |
+
data: RadarChallengeCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> RadarChallengeCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "radar.challenge_created"),
|
| 38 |
data=RadarChallengeCreatedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("RadarChallengeCreated", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/radar_challenge_created_data.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -21,7 +22,7 @@ class RadarChallengeCreatedData:
|
|
| 21 |
"""The email address of the user."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class RadarChallengeCreatedData:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("RadarChallengeCreatedData", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["type"] = self.type
|
| 40 |
result["radar_challenge_id"] = self.radar_challenge_id
|
| 41 |
result["user_id"] = self.user_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 22 |
"""The email address of the user."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> RadarChallengeCreatedData:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("RadarChallengeCreatedData", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["type"] = self.type
|
| 41 |
result["radar_challenge_id"] = self.radar_challenge_id
|
| 42 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/radar_standalone_assess_request_action.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class RadarStandaloneAssessRequestAction(str, Enum):
|
|
| 16 |
SIGN_IN = "sign-in"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
SIGN_IN = "sign-in"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> RadarStandaloneAssessRequestAction | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/radar_standalone_assess_request_auth_method.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -22,9 +21,7 @@ class RadarStandaloneAssessRequestAuthMethod(str, Enum):
|
|
| 22 |
OTHER = "Other"
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def _missing_(
|
| 26 |
-
cls, value: object
|
| 27 |
-
) ->
|
| 28 |
if not isinstance(value, str):
|
| 29 |
return None
|
| 30 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 21 |
OTHER = "Other"
|
| 22 |
|
| 23 |
@classmethod
|
|
|
|
|
|
|
| 24 |
+
def _missing_(cls, value: object) -> RadarStandaloneAssessRequestAuthMethod | None:
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/radar_standalone_response_control.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -21,7 +20,7 @@ class RadarStandaloneResponseControl(str, Enum):
|
|
| 21 |
RESTRICTION = "restriction"
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def _missing_(cls, value: object) ->
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
RESTRICTION = "restriction"
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def _missing_(cls, value: object) -> RadarStandaloneResponseControl | None:
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/radar_standalone_response_verdict.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class RadarStandaloneResponseVerdict(str, Enum):
|
|
| 17 |
CHALLENGE = "challenge"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
CHALLENGE = "challenge"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> RadarStandaloneResponseVerdict | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/role_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .role_created_data import RoleCreatedData
|
|
@@ -22,32 +21,32 @@ class RoleCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["role.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "role.created"),
|
| 39 |
-
data=RoleCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("RoleCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .role_created_data import RoleCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["role.created"]
|
| 24 |
+
data: RoleCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> RoleCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "role.created"),
|
| 38 |
+
data=RoleCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("RoleCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/role_created_data.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -23,11 +23,11 @@ class RoleCreatedData:
|
|
| 23 |
"""An ISO 8601 timestamp."""
|
| 24 |
updated_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
-
permissions:
|
| 27 |
"""The permissions granted by the role."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -41,9 +41,9 @@ class RoleCreatedData:
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("RoleCreatedData", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
result["object"] = self.object
|
| 48 |
result["slug"] = self.slug
|
| 49 |
result["resource_type_slug"] = self.resource_type_slug
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 23 |
"""An ISO 8601 timestamp."""
|
| 24 |
updated_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
| 26 |
+
permissions: list[str] | None = None
|
| 27 |
"""The permissions granted by the role."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> RoleCreatedData:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("RoleCreatedData", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["object"] = self.object
|
| 48 |
result["slug"] = self.slug
|
| 49 |
result["resource_type_slug"] = self.resource_type_slug
|
python/src/workos/common/models/role_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .role_deleted_data import RoleDeletedData
|
|
@@ -22,32 +21,32 @@ class RoleDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["role.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "role.deleted"),
|
| 39 |
-
data=RoleDeletedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("RoleDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .role_deleted_data import RoleDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["role.deleted"]
|
| 24 |
+
data: RoleDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> RoleDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "role.deleted"),
|
| 38 |
+
data=RoleDeletedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("RoleDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/role_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class RoleType(str, Enum):
|
|
| 16 |
ORGANIZATION_ROLE = "OrganizationRole"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
ORGANIZATION_ROLE = "OrganizationRole"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> RoleType | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/role_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .role_updated_data import RoleUpdatedData
|
|
@@ -22,32 +21,32 @@ class RoleUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["role.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "role.updated"),
|
| 39 |
-
data=RoleUpdatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("RoleUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .role_updated_data import RoleUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["role.updated"]
|
| 24 |
+
data: RoleUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> RoleUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "role.updated"),
|
| 38 |
+
data=RoleUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("RoleUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/session_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .session_created_data import SessionCreatedData
|
|
@@ -22,32 +21,32 @@ class SessionCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["session.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "session.created"),
|
| 39 |
-
data=SessionCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("SessionCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .session_created_data import SessionCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["session.created"]
|
| 24 |
+
data: SessionCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> SessionCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "session.created"),
|
| 38 |
+
data=SessionCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("SessionCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/session_created_data_auth_method.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -24,7 +23,7 @@ class SessionCreatedDataAuthMethod(str, Enum):
|
|
| 24 |
UNKNOWN = "unknown"
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
-
def _missing_(cls, value: object) ->
|
| 28 |
if not isinstance(value, str):
|
| 29 |
return None
|
| 30 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 23 |
UNKNOWN = "unknown"
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def _missing_(cls, value: object) -> SessionCreatedDataAuthMethod | None:
|
| 27 |
if not isinstance(value, str):
|
| 28 |
return None
|
| 29 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/session_created_data_status.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class SessionCreatedDataStatus(str, Enum):
|
|
| 17 |
REVOKED = "revoked"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
REVOKED = "revoked"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> SessionCreatedDataStatus | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/session_revoked.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .session_revoked_data import SessionRevokedData
|
|
@@ -22,32 +21,32 @@ class SessionRevoked:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["session.revoked"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "session.revoked"),
|
| 39 |
-
data=SessionRevokedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("SessionRevoked", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .session_revoked_data import SessionRevokedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["session.revoked"]
|
| 24 |
+
data: SessionRevokedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> SessionRevoked:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "session.revoked"),
|
| 38 |
+
data=SessionRevokedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("SessionRevoked", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/update_webhook_endpoint_status.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class UpdateWebhookEndpointStatus(str, Enum):
|
|
| 16 |
DISABLED = "disabled"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
DISABLED = "disabled"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> UpdateWebhookEndpointStatus | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/user_api_key_created_data_owner.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -19,7 +20,7 @@ class UserApiKeyCreatedDataOwner:
|
|
| 19 |
"""The unique identifier of the organization the API key belongs to."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class UserApiKeyCreatedDataOwner:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("UserApiKeyCreatedDataOwner", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["type"] = self.type
|
| 37 |
result["id"] = self.id
|
| 38 |
result["organization_id"] = self.organization_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
"""The unique identifier of the organization the API key belongs to."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> UserApiKeyCreatedDataOwner:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("UserApiKeyCreatedDataOwner", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["type"] = self.type
|
| 38 |
result["id"] = self.id
|
| 39 |
result["organization_id"] = self.organization_id
|
python/src/workos/common/models/user_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .user import User
|
|
@@ -22,32 +21,32 @@ class UserCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["user.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "user.created"),
|
| 39 |
-
data=User.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("UserCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .user import User
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["user.created"]
|
| 24 |
+
data: User
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> UserCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "user.created"),
|
| 38 |
+
data=User.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("UserCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/user_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .user import User
|
|
@@ -22,32 +21,32 @@ class UserDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["user.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "user.deleted"),
|
| 39 |
-
data=User.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("UserDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .user import User
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["user.deleted"]
|
| 24 |
+
data: User
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> UserDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "user.deleted"),
|
| 38 |
+
data=User.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("UserDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/user_identities_get_item_provider.py|
@@ -17,6 +17,8 @@ class UserIdentitiesGetItemProvider(str, Enum):
|
|
| 17 |
GITHUB_OAUTH = "GithubOAuth"
|
| 18 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 19 |
GOOGLE_OAUTH = "GoogleOAuth"
|
|
|
|
|
|
|
| 20 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 21 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 22 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
@@ -43,6 +45,8 @@ UserIdentitiesGetItemProviderLiteral: TypeAlias = Literal[
|
|
| 43 |
"GithubOAuth",
|
| 44 |
"GitLabOAuth",
|
| 45 |
"GoogleOAuth",
|
|
|
|
|
|
|
| 46 |
"IntuitOAuth",
|
| 47 |
"LinkedInOAuth",
|
| 48 |
"MicrosoftOAuth",
|
|
|
|
| 17 |
GITHUB_OAUTH = "GithubOAuth"
|
| 18 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 19 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 20 |
+
GROK_OAUTH = "GrokOAuth"
|
| 21 |
+
XO_AUTH = "XOAuth"
|
| 22 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 23 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 24 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
|
|
| 45 |
"GithubOAuth",
|
| 46 |
"GitLabOAuth",
|
| 47 |
"GoogleOAuth",
|
| 48 |
+
"GrokOAuth",
|
| 49 |
+
"XOAuth",
|
| 50 |
"IntuitOAuth",
|
| 51 |
"LinkedInOAuth",
|
| 52 |
"MicrosoftOAuth",
|
python/src/workos/common/models/user_organization_membership_base_list_data.py|
@@ -5,10 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
from .user import User
|
| 14 |
from .user_organization_membership_base_list_data_status import (
|
|
@@ -28,7 +27,7 @@ class UserOrganizationMembershipBaseListData:
|
|
| 28 |
"""The ID of the user."""
|
| 29 |
organization_id: str
|
| 30 |
"""The ID of the organization which the user belongs to."""
|
| 31 |
-
status:
|
| 32 |
"""The status of the organization membership. One of `active`, `inactive`, or `pending`."""
|
| 33 |
directory_managed: bool
|
| 34 |
"""Whether this organization membership is managed by a directory sync connection."""
|
|
@@ -36,17 +35,15 @@ class UserOrganizationMembershipBaseListData:
|
|
| 36 |
"""An ISO 8601 timestamp."""
|
| 37 |
updated_at: datetime
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
-
user:
|
| 40 |
"""The user that belongs to the organization through this membership."""
|
| 41 |
-
organization_name:
|
| 42 |
"""The name of the organization which the user belongs to."""
|
| 43 |
-
custom_attributes:
|
| 44 |
"""An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked."""
|
| 45 |
|
| 46 |
@classmethod
|
| 47 |
-
def from_dict(
|
| 48 |
-
cls, data: Dict[str, Any]
|
| 49 |
-
) ->
|
| 50 |
"""Deserialize from a dictionary."""
|
| 51 |
try:
|
| 52 |
return cls(
|
|
@@ -58,16 +55,16 @@ class UserOrganizationMembershipBaseListData:
|
|
| 58 |
directory_managed=data["directory_managed"],
|
| 59 |
created_at=_parse_datetime(data["created_at"]),
|
| 60 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 61 |
-
user=User.from_dict(cast(
|
| 62 |
organization_name=data.get("organization_name"),
|
| 63 |
custom_attributes=data.get("custom_attributes"),
|
| 64 |
)
|
| 65 |
except (KeyError, ValueError) as e:
|
| 66 |
_raise_deserialize_error("UserOrganizationMembershipBaseListData", e)
|
| 67 |
|
| 68 |
-
def to_dict(self) ->
|
| 69 |
"""Serialize to a dictionary."""
|
| 70 |
-
result:
|
| 71 |
result["object"] = self.object
|
| 72 |
result["id"] = self.id
|
| 73 |
result["user_id"] = self.user_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
|
| 12 |
from .user import User
|
| 13 |
from .user_organization_membership_base_list_data_status import (
|
|
|
|
| 27 |
"""The ID of the user."""
|
| 28 |
organization_id: str
|
| 29 |
"""The ID of the organization which the user belongs to."""
|
| 30 |
+
status: UserOrganizationMembershipBaseListDataStatus
|
| 31 |
"""The status of the organization membership. One of `active`, `inactive`, or `pending`."""
|
| 32 |
directory_managed: bool
|
| 33 |
"""Whether this organization membership is managed by a directory sync connection."""
|
|
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
updated_at: datetime
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
+
user: User
|
| 39 |
"""The user that belongs to the organization through this membership."""
|
| 40 |
+
organization_name: str | None = None
|
| 41 |
"""The name of the organization which the user belongs to."""
|
| 42 |
+
custom_attributes: dict[str, Any] | None = None
|
| 43 |
"""An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked."""
|
| 44 |
|
| 45 |
@classmethod
|
|
|
|
|
|
|
| 46 |
+
def from_dict(cls, data: dict[str, Any]) -> UserOrganizationMembershipBaseListData:
|
| 47 |
"""Deserialize from a dictionary."""
|
| 48 |
try:
|
| 49 |
return cls(
|
|
|
|
| 55 |
directory_managed=data["directory_managed"],
|
| 56 |
created_at=_parse_datetime(data["created_at"]),
|
| 57 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 58 |
+
user=User.from_dict(cast(dict[str, Any], data["user"])),
|
| 59 |
organization_name=data.get("organization_name"),
|
| 60 |
custom_attributes=data.get("custom_attributes"),
|
| 61 |
)
|
| 62 |
except (KeyError, ValueError) as e:
|
| 63 |
_raise_deserialize_error("UserOrganizationMembershipBaseListData", e)
|
| 64 |
|
| 65 |
+
def to_dict(self) -> dict[str, Any]:
|
| 66 |
"""Serialize to a dictionary."""
|
| 67 |
+
result: dict[str, Any] = {}
|
| 68 |
result["object"] = self.object
|
| 69 |
result["id"] = self.id
|
| 70 |
result["user_id"] = self.user_id
|
python/src/workos/common/models/user_organization_membership_base_list_data_status.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_membership_created_data_status import (
|
| 5 |
OrganizationMembershipCreatedDataStatus,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_membership_created_data_status import (
|
| 6 |
OrganizationMembershipCreatedDataStatus,
|
| 7 |
)
|
python/src/workos/common/models/user_organization_membership_status.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .organization_membership_created_data_status import (
|
| 5 |
OrganizationMembershipCreatedDataStatus,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .organization_membership_created_data_status import (
|
| 6 |
OrganizationMembershipCreatedDataStatus,
|
| 7 |
)
|
python/src/workos/common/models/user_role_assignment_source_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class UserRoleAssignmentSourceType(str, Enum):
|
|
| 16 |
GROUP = "group"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
GROUP = "group"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> UserRoleAssignmentSourceType | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/user_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .user import User
|
|
@@ -22,32 +21,32 @@ class UserUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["user.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "user.updated"),
|
| 39 |
-
data=User.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("UserUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .user import User
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["user.updated"]
|
| 24 |
+
data: User
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> UserUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "user.updated"),
|
| 38 |
+
data=User.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("UserUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_byok_key_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_byok_key_deleted_data import VaultByokKeyDeletedData
|
|
@@ -22,14 +21,14 @@ class VaultByokKeyDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.byok_key.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class VaultByokKeyDeleted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.byok_key.deleted"),
|
| 39 |
data=VaultByokKeyDeletedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("VaultByokKeyDeleted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_byok_key_deleted_data import VaultByokKeyDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.byok_key.deleted"]
|
| 24 |
+
data: VaultByokKeyDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultByokKeyDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.byok_key.deleted"),
|
| 38 |
data=VaultByokKeyDeletedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("VaultByokKeyDeleted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/vault_byok_key_deleted_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_byok_key_provider import VaultByokKeyProvider
|
| 10 |
|
| 11 |
|
|
@@ -15,10 +17,10 @@ class VaultByokKeyDeletedData:
|
|
| 15 |
|
| 16 |
organization_id: str
|
| 17 |
"""The unique identifier of the organization."""
|
| 18 |
-
key_provider:
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
-
def from_dict(cls, data:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
@@ -28,9 +30,9 @@ class VaultByokKeyDeletedData:
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("VaultByokKeyDeletedData", e)
|
| 30 |
|
| 31 |
-
def to_dict(self) ->
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
-
result:
|
| 34 |
result["organization_id"] = self.organization_id
|
| 35 |
result["key_provider"] = (
|
| 36 |
self.key_provider.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_byok_key_provider import VaultByokKeyProvider
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
organization_id: str
|
| 19 |
"""The unique identifier of the organization."""
|
| 20 |
+
key_provider: VaultByokKeyProvider
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultByokKeyDeletedData:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("VaultByokKeyDeletedData", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
result["organization_id"] = self.organization_id
|
| 37 |
result["key_provider"] = (
|
| 38 |
self.key_provider.value
|
python/src/workos/common/models/vault_byok_key_provider.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class VaultByokKeyProvider(str, Enum):
|
|
| 17 |
AZURE_KEY_VAULT = "AZURE_KEY_VAULT"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
AZURE_KEY_VAULT = "AZURE_KEY_VAULT"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> VaultByokKeyProvider | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/vault_byok_key_verification_completed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_byok_key_verification_completed_data import (
|
|
@@ -24,14 +23,14 @@ class VaultByokKeyVerificationCompleted:
|
|
| 24 |
id: str
|
| 25 |
"""Unique identifier for the event."""
|
| 26 |
event: Literal["vault.byok_key.verification_completed"]
|
| 27 |
-
data:
|
| 28 |
"""The event payload."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
-
context:
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -39,19 +38,19 @@ class VaultByokKeyVerificationCompleted:
|
|
| 39 |
id=data["id"],
|
| 40 |
event=data.get("event", "vault.byok_key.verification_completed"),
|
| 41 |
data=VaultByokKeyVerificationCompletedData.from_dict(
|
| 42 |
-
cast(
|
| 43 |
),
|
| 44 |
created_at=_parse_datetime(data["created_at"]),
|
| 45 |
-
context=EventContext.from_dict(cast(
|
| 46 |
if (_v_context := data.get("context")) is not None
|
| 47 |
else None,
|
| 48 |
)
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("VaultByokKeyVerificationCompleted", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_byok_key_verification_completed_data import (
|
|
|
|
| 23 |
id: str
|
| 24 |
"""Unique identifier for the event."""
|
| 25 |
event: Literal["vault.byok_key.verification_completed"]
|
| 26 |
+
data: VaultByokKeyVerificationCompletedData
|
| 27 |
"""The event payload."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
+
context: EventContext | None = None
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultByokKeyVerificationCompleted:
|
| 34 |
"""Deserialize from a dictionary."""
|
| 35 |
try:
|
| 36 |
return cls(
|
|
|
|
| 38 |
id=data["id"],
|
| 39 |
event=data.get("event", "vault.byok_key.verification_completed"),
|
| 40 |
data=VaultByokKeyVerificationCompletedData.from_dict(
|
| 41 |
+
cast(dict[str, Any], data["data"])
|
| 42 |
),
|
| 43 |
created_at=_parse_datetime(data["created_at"]),
|
| 44 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 45 |
if (_v_context := data.get("context")) is not None
|
| 46 |
else None,
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("VaultByokKeyVerificationCompleted", e)
|
| 50 |
|
| 51 |
+
def to_dict(self) -> dict[str, Any]:
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
+
result: dict[str, Any] = {}
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["event"] = self.event
|
python/src/workos/common/models/vault_byok_key_verification_completed_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_byok_key_provider import VaultByokKeyProvider
|
| 10 |
|
| 11 |
|
|
@@ -15,12 +17,12 @@ class VaultByokKeyVerificationCompletedData:
|
|
| 15 |
|
| 16 |
organization_id: str
|
| 17 |
"""The unique identifier of the organization."""
|
| 18 |
-
key_provider:
|
| 19 |
verified: bool
|
| 20 |
"""Whether the BYOK key verification completed successfully."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
@@ -31,9 +33,9 @@ class VaultByokKeyVerificationCompletedData:
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("VaultByokKeyVerificationCompletedData", e)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["organization_id"] = self.organization_id
|
| 38 |
result["key_provider"] = (
|
| 39 |
self.key_provider.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_byok_key_provider import VaultByokKeyProvider
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
organization_id: str
|
| 19 |
"""The unique identifier of the organization."""
|
| 20 |
+
key_provider: VaultByokKeyProvider
|
| 21 |
verified: bool
|
| 22 |
"""Whether the BYOK key verification completed successfully."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultByokKeyVerificationCompletedData:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("VaultByokKeyVerificationCompletedData", e)
|
| 35 |
|
| 36 |
+
def to_dict(self) -> dict[str, Any]:
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
+
result: dict[str, Any] = {}
|
| 39 |
result["organization_id"] = self.organization_id
|
| 40 |
result["key_provider"] = (
|
| 41 |
self.key_provider.value
|
python/src/workos/common/models/vault_data_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_data_created_data import VaultDataCreatedData
|
|
@@ -22,32 +21,32 @@ class VaultDataCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.data.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.data.created"),
|
| 39 |
-
data=VaultDataCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultDataCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_data_created_data import VaultDataCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.data.created"]
|
| 24 |
+
data: VaultDataCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.data.created"),
|
| 38 |
+
data=VaultDataCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultDataCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_data_created_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_data_created_data_actor_source import VaultDataCreatedDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,17 +17,17 @@ class VaultDataCreatedData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
kv_name: str
|
| 22 |
"""The name of the key-value store."""
|
| 23 |
key_id: str
|
| 24 |
"""The unique identifier of the encryption key."""
|
| 25 |
-
key_context:
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(cls, data:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -39,9 +41,9 @@ class VaultDataCreatedData:
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("VaultDataCreatedData", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["actor_id"] = self.actor_id
|
| 46 |
result["actor_source"] = (
|
| 47 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_data_created_data_actor_source import VaultDataCreatedDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultDataCreatedDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
kv_name: str
|
| 24 |
"""The name of the key-value store."""
|
| 25 |
key_id: str
|
| 26 |
"""The unique identifier of the encryption key."""
|
| 27 |
+
key_context: dict[str, str]
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataCreatedData:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("VaultDataCreatedData", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["actor_id"] = self.actor_id
|
| 48 |
result["actor_source"] = (
|
| 49 |
self.actor_source.value
|
python/src/workos/common/models/vault_data_created_data_actor_source.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class VaultDataCreatedDataActorSource(str, Enum):
|
|
| 16 |
DASHBOARD = "dashboard"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
DASHBOARD = "dashboard"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> VaultDataCreatedDataActorSource | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/vault_data_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_data_deleted_data import VaultDataDeletedData
|
|
@@ -22,32 +21,32 @@ class VaultDataDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.data.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.data.deleted"),
|
| 39 |
-
data=VaultDataDeletedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultDataDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_data_deleted_data import VaultDataDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.data.deleted"]
|
| 24 |
+
data: VaultDataDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.data.deleted"),
|
| 38 |
+
data=VaultDataDeletedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultDataDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_data_deleted_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_data_deleted_data_actor_source import VaultDataDeletedDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,14 +17,14 @@ class VaultDataDeletedData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
kv_name: str
|
| 22 |
"""The name of the key-value store."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def from_dict(cls, data:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
@@ -34,9 +36,9 @@ class VaultDataDeletedData:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("VaultDataDeletedData", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["actor_id"] = self.actor_id
|
| 41 |
result["actor_source"] = (
|
| 42 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_data_deleted_data_actor_source import VaultDataDeletedDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultDataDeletedDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
kv_name: str
|
| 24 |
"""The name of the key-value store."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataDeletedData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("VaultDataDeletedData", e)
|
| 38 |
|
| 39 |
+
def to_dict(self) -> dict[str, Any]:
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
+
result: dict[str, Any] = {}
|
| 42 |
result["actor_id"] = self.actor_id
|
| 43 |
result["actor_source"] = (
|
| 44 |
self.actor_source.value
|
python/src/workos/common/models/vault_data_read.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_data_read_data import VaultDataReadData
|
|
@@ -22,32 +21,32 @@ class VaultDataRead:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.data.read"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.data.read"),
|
| 39 |
-
data=VaultDataReadData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultDataRead", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_data_read_data import VaultDataReadData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.data.read"]
|
| 24 |
+
data: VaultDataReadData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataRead:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.data.read"),
|
| 38 |
+
data=VaultDataReadData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultDataRead", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_data_read_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_data_read_data_actor_source import VaultDataReadDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,7 +17,7 @@ class VaultDataReadData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
kv_name: str
|
|
@@ -24,7 +26,7 @@ class VaultDataReadData:
|
|
| 24 |
"""The unique identifier of the encryption key."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
-
def from_dict(cls, data:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
@@ -37,9 +39,9 @@ class VaultDataReadData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("VaultDataReadData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["actor_id"] = self.actor_id
|
| 44 |
result["actor_source"] = (
|
| 45 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_data_read_data_actor_source import VaultDataReadDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultDataReadDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
kv_name: str
|
|
|
|
| 26 |
"""The unique identifier of the encryption key."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataReadData:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("VaultDataReadData", e)
|
| 41 |
|
| 42 |
+
def to_dict(self) -> dict[str, Any]:
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
+
result: dict[str, Any] = {}
|
| 45 |
result["actor_id"] = self.actor_id
|
| 46 |
result["actor_source"] = (
|
| 47 |
self.actor_source.value
|
python/src/workos/common/models/vault_data_updated.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_data_updated_data import VaultDataUpdatedData
|
|
@@ -22,32 +21,32 @@ class VaultDataUpdated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.data.updated"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.data.updated"),
|
| 39 |
-
data=VaultDataUpdatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultDataUpdated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_data_updated_data import VaultDataUpdatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.data.updated"]
|
| 24 |
+
data: VaultDataUpdatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDataUpdated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.data.updated"),
|
| 38 |
+
data=VaultDataUpdatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultDataUpdated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_dek_decrypted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_dek_decrypted_data import VaultDekDecryptedData
|
|
@@ -22,14 +21,14 @@ class VaultDekDecrypted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.dek.decrypted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class VaultDekDecrypted:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.dek.decrypted"),
|
| 39 |
data=VaultDekDecryptedData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("VaultDekDecrypted", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_dek_decrypted_data import VaultDekDecryptedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.dek.decrypted"]
|
| 24 |
+
data: VaultDekDecryptedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDekDecrypted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.dek.decrypted"),
|
| 38 |
data=VaultDekDecryptedData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("VaultDekDecrypted", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/vault_dek_decrypted_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_dek_decrypted_data_actor_source import VaultDekDecryptedDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,14 +17,14 @@ class VaultDekDecryptedData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
key_id: str
|
| 22 |
"""The unique identifier of the data encryption key."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def from_dict(cls, data:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
@@ -34,9 +36,9 @@ class VaultDekDecryptedData:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("VaultDekDecryptedData", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["actor_id"] = self.actor_id
|
| 41 |
result["actor_source"] = (
|
| 42 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_dek_decrypted_data_actor_source import VaultDekDecryptedDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultDekDecryptedDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
key_id: str
|
| 24 |
"""The unique identifier of the data encryption key."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDekDecryptedData:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("VaultDekDecryptedData", e)
|
| 38 |
|
| 39 |
+
def to_dict(self) -> dict[str, Any]:
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
+
result: dict[str, Any] = {}
|
| 42 |
result["actor_id"] = self.actor_id
|
| 43 |
result["actor_source"] = (
|
| 44 |
self.actor_source.value
|
python/src/workos/common/models/vault_dek_read.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_dek_read_data import VaultDekReadData
|
|
@@ -22,32 +21,32 @@ class VaultDekRead:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.dek.read"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.dek.read"),
|
| 39 |
-
data=VaultDekReadData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultDekRead", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_dek_read_data import VaultDekReadData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.dek.read"]
|
| 24 |
+
data: VaultDekReadData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDekRead:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.dek.read"),
|
| 38 |
+
data=VaultDekReadData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultDekRead", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_dek_read_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_dek_read_data_actor_source import VaultDekReadDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,15 +17,15 @@ class VaultDekReadData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
-
key_ids:
|
| 22 |
"""The unique identifiers of the data encryption keys."""
|
| 23 |
-
key_context:
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -36,9 +38,9 @@ class VaultDekReadData:
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("VaultDekReadData", e)
|
| 38 |
|
| 39 |
-
def to_dict(self) ->
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
-
result:
|
| 42 |
result["actor_id"] = self.actor_id
|
| 43 |
result["actor_source"] = (
|
| 44 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_dek_read_data_actor_source import VaultDekReadDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultDekReadDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
+
key_ids: list[str]
|
| 24 |
"""The unique identifiers of the data encryption keys."""
|
| 25 |
+
key_context: dict[str, str]
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultDekReadData:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("VaultDekReadData", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["actor_id"] = self.actor_id
|
| 45 |
result["actor_source"] = (
|
| 46 |
self.actor_source.value
|
python/src/workos/common/models/vault_kek_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_kek_created_data import VaultKekCreatedData
|
|
@@ -22,32 +21,32 @@ class VaultKekCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.kek.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.kek.created"),
|
| 39 |
-
data=VaultKekCreatedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultKekCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_kek_created_data import VaultKekCreatedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.kek.created"]
|
| 24 |
+
data: VaultKekCreatedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultKekCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.kek.created"),
|
| 38 |
+
data=VaultKekCreatedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultKekCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_kek_created_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_kek_created_data_actor_source import VaultKekCreatedDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,7 +17,7 @@ class VaultKekCreatedData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
key_name: str
|
|
@@ -24,7 +26,7 @@ class VaultKekCreatedData:
|
|
| 24 |
"""The unique identifier of the key encryption key."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
-
def from_dict(cls, data:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
@@ -37,9 +39,9 @@ class VaultKekCreatedData:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("VaultKekCreatedData", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["actor_id"] = self.actor_id
|
| 44 |
result["actor_source"] = (
|
| 45 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_kek_created_data_actor_source import VaultKekCreatedDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultKekCreatedDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
key_name: str
|
|
|
|
| 26 |
"""The unique identifier of the key encryption key."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultKekCreatedData:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("VaultKekCreatedData", e)
|
| 41 |
|
| 42 |
+
def to_dict(self) -> dict[str, Any]:
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
+
result: dict[str, Any] = {}
|
| 45 |
result["actor_id"] = self.actor_id
|
| 46 |
result["actor_source"] = (
|
| 47 |
self.actor_source.value
|
python/src/workos/common/models/vault_kek_deleted.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_kek_deleted_data import VaultKekDeletedData
|
|
@@ -22,32 +21,32 @@ class VaultKekDeleted:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.kek.deleted"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.kek.deleted"),
|
| 39 |
-
data=VaultKekDeletedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultKekDeleted", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_kek_deleted_data import VaultKekDeletedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.kek.deleted"]
|
| 24 |
+
data: VaultKekDeletedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultKekDeleted:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.kek.deleted"),
|
| 38 |
+
data=VaultKekDeletedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultKekDeleted", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_metadata_read.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_metadata_read_data import VaultMetadataReadData
|
|
@@ -22,14 +21,14 @@ class VaultMetadataRead:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.metadata.read"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -37,19 +36,19 @@ class VaultMetadataRead:
|
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.metadata.read"),
|
| 39 |
data=VaultMetadataReadData.from_dict(
|
| 40 |
-
cast(
|
| 41 |
),
|
| 42 |
created_at=_parse_datetime(data["created_at"]),
|
| 43 |
-
context=EventContext.from_dict(cast(
|
| 44 |
if (_v_context := data.get("context")) is not None
|
| 45 |
else None,
|
| 46 |
)
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("VaultMetadataRead", e)
|
| 49 |
|
| 50 |
-
def to_dict(self) ->
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
-
result:
|
| 53 |
result["object"] = self.object
|
| 54 |
result["id"] = self.id
|
| 55 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_metadata_read_data import VaultMetadataReadData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.metadata.read"]
|
| 24 |
+
data: VaultMetadataReadData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultMetadataRead:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.metadata.read"),
|
| 38 |
data=VaultMetadataReadData.from_dict(
|
| 39 |
+
cast(dict[str, Any], data["data"])
|
| 40 |
),
|
| 41 |
created_at=_parse_datetime(data["created_at"]),
|
| 42 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 43 |
if (_v_context := data.get("context")) is not None
|
| 44 |
else None,
|
| 45 |
)
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("VaultMetadataRead", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["event"] = self.event
|
python/src/workos/common/models/vault_names_listed.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .vault_names_listed_data import VaultNamesListedData
|
|
@@ -22,32 +21,32 @@ class VaultNamesListed:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["vault.names.listed"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "vault.names.listed"),
|
| 39 |
-
data=VaultNamesListedData.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("VaultNamesListed", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .vault_names_listed_data import VaultNamesListedData
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["vault.names.listed"]
|
| 24 |
+
data: VaultNamesListedData
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultNamesListed:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "vault.names.listed"),
|
| 38 |
+
data=VaultNamesListedData.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("VaultNamesListed", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/vault_names_listed_data.py|
@@ -4,8 +4,10 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
|
|
|
| 9 |
from .vault_names_listed_data_actor_source import VaultNamesListedDataActorSource
|
| 10 |
|
| 11 |
|
|
@@ -15,12 +17,12 @@ class VaultNamesListedData:
|
|
| 15 |
|
| 16 |
actor_id: str
|
| 17 |
"""The unique identifier of the actor."""
|
| 18 |
-
actor_source:
|
| 19 |
actor_name: str
|
| 20 |
"""The name of the actor."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
@@ -31,9 +33,9 @@ class VaultNamesListedData:
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("VaultNamesListedData", e)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["actor_id"] = self.actor_id
|
| 38 |
result["actor_source"] = (
|
| 39 |
self.actor_source.value
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
+
|
| 11 |
from .vault_names_listed_data_actor_source import VaultNamesListedDataActorSource
|
| 12 |
|
| 13 |
|
|
|
|
| 17 |
|
| 18 |
actor_id: str
|
| 19 |
"""The unique identifier of the actor."""
|
| 20 |
+
actor_source: VaultNamesListedDataActorSource
|
| 21 |
actor_name: str
|
| 22 |
"""The name of the actor."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultNamesListedData:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("VaultNamesListedData", e)
|
| 35 |
|
| 36 |
+
def to_dict(self) -> dict[str, Any]:
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
+
result: dict[str, Any] = {}
|
| 39 |
result["actor_id"] = self.actor_id
|
| 40 |
result["actor_source"] = (
|
| 41 |
self.actor_source.value
|
python/src/workos/common/models/waitlist_user.py|
@@ -5,9 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
|
|
|
| 11 |
from .waitlist_user_state import WaitlistUserState
|
| 12 |
|
| 13 |
|
|
@@ -21,17 +22,19 @@ class WaitlistUser:
|
|
| 21 |
"""The unique ID of the Waitlist User."""
|
| 22 |
email: str
|
| 23 |
"""The email address of the Waitlist User."""
|
| 24 |
-
state:
|
| 25 |
"""The state of the Waitlist User."""
|
| 26 |
-
approved_at:
|
| 27 |
"""The timestamp when the Waitlist User was approved, or null if not yet approved."""
|
| 28 |
created_at: datetime
|
| 29 |
"""An ISO 8601 timestamp."""
|
| 30 |
updated_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@classmethod
|
| 34 |
-
def from_dict(cls, data:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
@@ -44,13 +47,14 @@ class WaitlistUser:
|
|
| 44 |
else None,
|
| 45 |
created_at=_parse_datetime(data["created_at"]),
|
| 46 |
updated_at=_parse_datetime(data["updated_at"]),
|
|
|
|
| 47 |
)
|
| 48 |
except (KeyError, ValueError) as e:
|
| 49 |
_raise_deserialize_error("WaitlistUser", e)
|
| 50 |
|
| 51 |
-
def to_dict(self) ->
|
| 52 |
"""Serialize to a dictionary."""
|
| 53 |
-
result:
|
| 54 |
result["object"] = self.object
|
| 55 |
result["id"] = self.id
|
| 56 |
result["email"] = self.email
|
|
@@ -63,4 +67,8 @@ class WaitlistUser:
|
|
| 63 |
result["approved_at"] = None
|
| 64 |
result["created_at"] = _format_datetime(self.created_at)
|
| 65 |
result["updated_at"] = _format_datetime(self.updated_at)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
return result
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
+
|
| 12 |
from .waitlist_user_state import WaitlistUserState
|
| 13 |
|
| 14 |
|
|
|
|
| 22 |
"""The unique ID of the Waitlist User."""
|
| 23 |
email: str
|
| 24 |
"""The email address of the Waitlist User."""
|
| 25 |
+
state: WaitlistUserState
|
| 26 |
"""The state of the Waitlist User."""
|
| 27 |
+
approved_at: datetime | None
|
| 28 |
"""The timestamp when the Waitlist User was approved, or null if not yet approved."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
updated_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
+
waitlist_id: str | None = None
|
| 34 |
+
"""The unique ID of the Waitlist that the Waitlist User joined."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> WaitlistUser:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 47 |
else None,
|
| 48 |
created_at=_parse_datetime(data["created_at"]),
|
| 49 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 50 |
+
waitlist_id=data.get("waitlist_id"),
|
| 51 |
)
|
| 52 |
except (KeyError, ValueError) as e:
|
| 53 |
_raise_deserialize_error("WaitlistUser", e)
|
| 54 |
|
| 55 |
+
def to_dict(self) -> dict[str, Any]:
|
| 56 |
"""Serialize to a dictionary."""
|
| 57 |
+
result: dict[str, Any] = {}
|
| 58 |
result["object"] = self.object
|
| 59 |
result["id"] = self.id
|
| 60 |
result["email"] = self.email
|
|
|
|
| 67 |
result["approved_at"] = None
|
| 68 |
result["created_at"] = _format_datetime(self.created_at)
|
| 69 |
result["updated_at"] = _format_datetime(self.updated_at)
|
| 70 |
+
if self.waitlist_id is not None:
|
| 71 |
+
result["waitlist_id"] = self.waitlist_id
|
| 72 |
+
else:
|
| 73 |
+
result["waitlist_id"] = None
|
| 74 |
return result
|
python/src/workos/common/models/waitlist_user_approved.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .waitlist_user import WaitlistUser
|
|
@@ -22,32 +21,32 @@ class WaitlistUserApproved:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["waitlist_user.approved"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "waitlist_user.approved"),
|
| 39 |
-
data=WaitlistUser.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("WaitlistUserApproved", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .waitlist_user import WaitlistUser
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["waitlist_user.approved"]
|
| 24 |
+
data: WaitlistUser
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> WaitlistUserApproved:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "waitlist_user.approved"),
|
| 38 |
+
data=WaitlistUser.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("WaitlistUserApproved", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/waitlist_user_created.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .waitlist_user import WaitlistUser
|
|
@@ -22,32 +21,32 @@ class WaitlistUserCreated:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["waitlist_user.created"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "waitlist_user.created"),
|
| 39 |
-
data=WaitlistUser.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("WaitlistUserCreated", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .waitlist_user import WaitlistUser
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["waitlist_user.created"]
|
| 24 |
+
data: WaitlistUser
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> WaitlistUserCreated:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "waitlist_user.created"),
|
| 38 |
+
data=WaitlistUser.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("WaitlistUserCreated", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/waitlist_user_denied.py|
@@ -4,10 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
| 12 |
from .event_context import EventContext
|
| 13 |
from .waitlist_user import WaitlistUser
|
|
@@ -22,32 +21,32 @@ class WaitlistUserDenied:
|
|
| 22 |
id: str
|
| 23 |
"""Unique identifier for the event."""
|
| 24 |
event: Literal["waitlist_user.denied"]
|
| 25 |
-
data:
|
| 26 |
"""The event payload."""
|
| 27 |
created_at: datetime
|
| 28 |
"""An ISO 8601 timestamp."""
|
| 29 |
-
context:
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
| 36 |
object=data.get("object", "event"),
|
| 37 |
id=data["id"],
|
| 38 |
event=data.get("event", "waitlist_user.denied"),
|
| 39 |
-
data=WaitlistUser.from_dict(cast(
|
| 40 |
created_at=_parse_datetime(data["created_at"]),
|
| 41 |
-
context=EventContext.from_dict(cast(
|
| 42 |
if (_v_context := data.get("context")) is not None
|
| 43 |
else None,
|
| 44 |
)
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("WaitlistUserDenied", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["object"] = self.object
|
| 52 |
result["id"] = self.id
|
| 53 |
result["event"] = self.event
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
from .event_context import EventContext
|
| 12 |
from .waitlist_user import WaitlistUser
|
|
|
|
| 21 |
id: str
|
| 22 |
"""Unique identifier for the event."""
|
| 23 |
event: Literal["waitlist_user.denied"]
|
| 24 |
+
data: WaitlistUser
|
| 25 |
"""The event payload."""
|
| 26 |
created_at: datetime
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
+
context: EventContext | None = None
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> WaitlistUserDenied:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
| 35 |
object=data.get("object", "event"),
|
| 36 |
id=data["id"],
|
| 37 |
event=data.get("event", "waitlist_user.denied"),
|
| 38 |
+
data=WaitlistUser.from_dict(cast(dict[str, Any], data["data"])),
|
| 39 |
created_at=_parse_datetime(data["created_at"]),
|
| 40 |
+
context=EventContext.from_dict(cast(dict[str, Any], _v_context))
|
| 41 |
if (_v_context := data.get("context")) is not None
|
| 42 |
else None,
|
| 43 |
)
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("WaitlistUserDenied", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["object"] = self.object
|
| 51 |
result["id"] = self.id
|
| 52 |
result["event"] = self.event
|
python/src/workos/common/models/waitlist_user_state.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -17,7 +16,7 @@ class WaitlistUserState(str, Enum):
|
|
| 17 |
DENIED = "denied"
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def _missing_(cls, value: object) ->
|
| 21 |
if not isinstance(value, str):
|
| 22 |
return None
|
| 23 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
DENIED = "denied"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def _missing_(cls, value: object) -> WaitlistUserState | None:
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
python/src/workos/common/models/widget_session_token_scopes.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -21,7 +20,7 @@ class WidgetSessionTokenScopes(str, Enum):
|
|
| 21 |
WIDGETS_PIPES_MANAGE = "widgets:pipes:manage"
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def _missing_(cls, value: object) ->
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
WIDGETS_PIPES_MANAGE = "widgets:pipes:manage"
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def _missing_(cls, value: object) -> WidgetSessionTokenScopes | None:
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
python/src/workos/connect/_resource.py|
@@ -2,14 +2,22 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any,
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
-
from .._types import
|
| 11 |
from .models import (
|
| 12 |
ApplicationCredentialsListItem,
|
|
|
|
| 13 |
CreateM2MApplication,
|
| 14 |
CreateOAuthApplication,
|
| 15 |
ExternalAuthCompleteResponse,
|
|
@@ -18,17 +26,12 @@ from .models import (
|
|
| 18 |
UserConsentOption,
|
| 19 |
UserObject,
|
| 20 |
)
|
| 21 |
-
from workos.common.models.connect_application import ConnectApplication
|
| 22 |
-
from workos.common.models.connect_application import ConnectApplicationVariant
|
| 23 |
-
from .models import ApplicationsRegistrationTypes
|
| 24 |
-
from workos.common.models.pagination_order import PaginationOrder
|
| 25 |
-
from .._pagination import AsyncPage, SyncPage
|
| 26 |
|
| 27 |
|
| 28 |
class Connect:
|
| 29 |
"""Connect API resources."""
|
| 30 |
|
| 31 |
-
def __init__(self, client:
|
| 32 |
self._client = client
|
| 33 |
|
| 34 |
def complete_oauth2(
|
|
@@ -36,8 +39,8 @@ class Connect:
|
|
| 36 |
*,
|
| 37 |
external_auth_id: str,
|
| 38 |
user: UserObject,
|
| 39 |
-
user_consent_options:
|
| 40 |
-
request_options:
|
| 41 |
) -> ExternalAuthCompleteResponse:
|
| 42 |
"""Complete external authentication
|
| 43 |
|
|
@@ -69,7 +72,7 @@ class Connect:
|
|
| 69 |
RateLimitExceededError: If rate limited (429).
|
| 70 |
ServerError: If the server returns a 5xx error.
|
| 71 |
"""
|
| 72 |
-
body:
|
| 73 |
k: v
|
| 74 |
for k, v in {
|
| 75 |
"external_auth_id": external_auth_id,
|
|
@@ -93,15 +96,13 @@ class Connect:
|
|
| 93 |
def list_applications(
|
| 94 |
self,
|
| 95 |
*,
|
| 96 |
-
limit:
|
| 97 |
-
before:
|
| 98 |
-
after:
|
| 99 |
-
order:
|
| 100 |
-
registration_types: Optional[
|
| 101 |
-
|
| 102 |
-
] = None,
|
| 103 |
-
organization_id:
|
| 104 |
-
request_options:
|
| 105 |
) -> SyncPage[ConnectApplicationVariant]:
|
| 106 |
"""List Connect Applications
|
| 107 |
|
|
@@ -153,8 +154,8 @@ class Connect:
|
|
| 153 |
def create_application(
|
| 154 |
self,
|
| 155 |
*,
|
| 156 |
-
body:
|
| 157 |
-
request_options:
|
| 158 |
) -> ConnectApplicationVariant:
|
| 159 |
"""Create a Connect Application
|
| 160 |
|
|
@@ -174,7 +175,7 @@ class Connect:
|
|
| 174 |
RateLimitExceededError: If rate limited (429).
|
| 175 |
ServerError: If the server returns a 5xx error.
|
| 176 |
"""
|
| 177 |
-
_body:
|
| 178 |
return cast(
|
| 179 |
ConnectApplicationVariant,
|
| 180 |
self._client.request(
|
|
@@ -191,15 +192,15 @@ class Connect:
|
|
| 191 |
*,
|
| 192 |
name: str,
|
| 193 |
is_first_party: bool,
|
| 194 |
-
description:
|
| 195 |
-
scopes:
|
| 196 |
-
redirect_uris:
|
| 197 |
-
uses_pkce:
|
| 198 |
-
organization_id:
|
| 199 |
-
request_options:
|
| 200 |
) -> ConnectApplicationVariant:
|
| 201 |
"""Create oauth application."""
|
| 202 |
-
body:
|
| 203 |
"application_type": "oauth",
|
| 204 |
"name": name,
|
| 205 |
"is_first_party": is_first_party,
|
|
@@ -231,12 +232,12 @@ class Connect:
|
|
| 231 |
*,
|
| 232 |
name: str,
|
| 233 |
organization_id: str,
|
| 234 |
-
description:
|
| 235 |
-
scopes:
|
| 236 |
-
request_options:
|
| 237 |
) -> ConnectApplicationVariant:
|
| 238 |
"""Create m2m application."""
|
| 239 |
-
body:
|
| 240 |
"application_type": "m2m",
|
| 241 |
"name": name,
|
| 242 |
"organization_id": organization_id,
|
|
@@ -261,7 +262,7 @@ class Connect:
|
|
| 261 |
self,
|
| 262 |
id: str,
|
| 263 |
*,
|
| 264 |
-
request_options:
|
| 265 |
) -> ConnectApplicationVariant:
|
| 266 |
"""Get a Connect Application
|
| 267 |
|
|
@@ -294,11 +295,11 @@ class Connect:
|
|
| 294 |
self,
|
| 295 |
id: str,
|
| 296 |
*,
|
| 297 |
-
name:
|
| 298 |
-
description:
|
| 299 |
-
scopes:
|
| 300 |
-
redirect_uris:
|
| 301 |
-
request_options:
|
| 302 |
) -> ConnectApplicationVariant:
|
| 303 |
"""Update a Connect Application
|
| 304 |
|
|
@@ -322,7 +323,7 @@ class Connect:
|
|
| 322 |
RateLimitExceededError: If rate limited (429).
|
| 323 |
ServerError: If the server returns a 5xx error.
|
| 324 |
"""
|
| 325 |
-
body:
|
| 326 |
k: v
|
| 327 |
for k, v in {
|
| 328 |
"name": name,
|
|
@@ -354,7 +355,7 @@ class Connect:
|
|
| 354 |
self,
|
| 355 |
id: str,
|
| 356 |
*,
|
| 357 |
-
request_options:
|
| 358 |
) -> None:
|
| 359 |
"""Delete a Connect Application
|
| 360 |
|
|
@@ -380,8 +381,8 @@ class Connect:
|
|
| 380 |
self,
|
| 381 |
id: str,
|
| 382 |
*,
|
| 383 |
-
request_options:
|
| 384 |
-
) ->
|
| 385 |
"""List Client Secrets for a Connect Application
|
| 386 |
|
| 387 |
List all client secrets associated with a Connect Application.
|
|
@@ -405,7 +406,7 @@ class Connect:
|
|
| 405 |
request_options=request_options,
|
| 406 |
)
|
| 407 |
return [
|
| 408 |
-
ApplicationCredentialsListItem.from_dict(cast(
|
| 409 |
for item in raw
|
| 410 |
]
|
| 411 |
|
|
@@ -413,7 +414,7 @@ class Connect:
|
|
| 413 |
self,
|
| 414 |
id: str,
|
| 415 |
*,
|
| 416 |
-
request_options:
|
| 417 |
) -> NewConnectApplicationSecret:
|
| 418 |
"""Create a new client secret for a Connect Application
|
| 419 |
|
|
@@ -433,7 +434,7 @@ class Connect:
|
|
| 433 |
RateLimitExceededError: If rate limited (429).
|
| 434 |
ServerError: If the server returns a 5xx error.
|
| 435 |
"""
|
| 436 |
-
body:
|
| 437 |
return self._client.request(
|
| 438 |
method="post",
|
| 439 |
path=("connect", "applications", str(id), "client_secrets"),
|
|
@@ -446,7 +447,7 @@ class Connect:
|
|
| 446 |
self,
|
| 447 |
id: str,
|
| 448 |
*,
|
| 449 |
-
request_options:
|
| 450 |
) -> None:
|
| 451 |
"""Delete a Client Secret
|
| 452 |
|
|
@@ -472,7 +473,7 @@ class Connect:
|
|
| 472 |
class AsyncConnect:
|
| 473 |
"""Connect API resources (async)."""
|
| 474 |
|
| 475 |
-
def __init__(self, client:
|
| 476 |
self._client = client
|
| 477 |
|
| 478 |
async def complete_oauth2(
|
|
@@ -480,8 +481,8 @@ class AsyncConnect:
|
|
| 480 |
*,
|
| 481 |
external_auth_id: str,
|
| 482 |
user: UserObject,
|
| 483 |
-
user_consent_options:
|
| 484 |
-
request_options:
|
| 485 |
) -> ExternalAuthCompleteResponse:
|
| 486 |
"""Complete external authentication
|
| 487 |
|
|
@@ -513,7 +514,7 @@ class AsyncConnect:
|
|
| 513 |
RateLimitExceededError: If rate limited (429).
|
| 514 |
ServerError: If the server returns a 5xx error.
|
| 515 |
"""
|
| 516 |
-
body:
|
| 517 |
k: v
|
| 518 |
for k, v in {
|
| 519 |
"external_auth_id": external_auth_id,
|
|
@@ -537,15 +538,13 @@ class AsyncConnect:
|
|
| 537 |
async def list_applications(
|
| 538 |
self,
|
| 539 |
*,
|
| 540 |
-
limit:
|
| 541 |
-
before:
|
| 542 |
-
after:
|
| 543 |
-
order:
|
| 544 |
-
registration_types: Optional[
|
| 545 |
-
|
| 546 |
-
] = None,
|
| 547 |
-
organization_id:
|
| 548 |
-
request_options:
|
| 549 |
) -> AsyncPage[ConnectApplicationVariant]:
|
| 550 |
"""List Connect Applications
|
| 551 |
|
|
@@ -597,8 +596,8 @@ class AsyncConnect:
|
|
| 597 |
async def create_application(
|
| 598 |
self,
|
| 599 |
*,
|
| 600 |
-
body:
|
| 601 |
-
request_options:
|
| 602 |
) -> ConnectApplicationVariant:
|
| 603 |
"""Create a Connect Application
|
| 604 |
|
|
@@ -618,7 +617,7 @@ class AsyncConnect:
|
|
| 618 |
RateLimitExceededError: If rate limited (429).
|
| 619 |
ServerError: If the server returns a 5xx error.
|
| 620 |
"""
|
| 621 |
-
_body:
|
| 622 |
return cast(
|
| 623 |
ConnectApplicationVariant,
|
| 624 |
await self._client.request(
|
|
@@ -635,15 +634,15 @@ class AsyncConnect:
|
|
| 635 |
*,
|
| 636 |
name: str,
|
| 637 |
is_first_party: bool,
|
| 638 |
-
description:
|
| 639 |
-
scopes:
|
| 640 |
-
redirect_uris:
|
| 641 |
-
uses_pkce:
|
| 642 |
-
organization_id:
|
| 643 |
-
request_options:
|
| 644 |
) -> ConnectApplicationVariant:
|
| 645 |
"""Create oauth application."""
|
| 646 |
-
body:
|
| 647 |
"application_type": "oauth",
|
| 648 |
"name": name,
|
| 649 |
"is_first_party": is_first_party,
|
|
@@ -675,12 +674,12 @@ class AsyncConnect:
|
|
| 675 |
*,
|
| 676 |
name: str,
|
| 677 |
organization_id: str,
|
| 678 |
-
description:
|
| 679 |
-
scopes:
|
| 680 |
-
request_options:
|
| 681 |
) -> ConnectApplicationVariant:
|
| 682 |
"""Create m2m application."""
|
| 683 |
-
body:
|
| 684 |
"application_type": "m2m",
|
| 685 |
"name": name,
|
| 686 |
"organization_id": organization_id,
|
|
@@ -705,7 +704,7 @@ class AsyncConnect:
|
|
| 705 |
self,
|
| 706 |
id: str,
|
| 707 |
*,
|
| 708 |
-
request_options:
|
| 709 |
) -> ConnectApplicationVariant:
|
| 710 |
"""Get a Connect Application
|
| 711 |
|
|
@@ -738,11 +737,11 @@ class AsyncConnect:
|
|
| 738 |
self,
|
| 739 |
id: str,
|
| 740 |
*,
|
| 741 |
-
name:
|
| 742 |
-
description:
|
| 743 |
-
scopes:
|
| 744 |
-
redirect_uris:
|
| 745 |
-
request_options:
|
| 746 |
) -> ConnectApplicationVariant:
|
| 747 |
"""Update a Connect Application
|
| 748 |
|
|
@@ -766,7 +765,7 @@ class AsyncConnect:
|
|
| 766 |
RateLimitExceededError: If rate limited (429).
|
| 767 |
ServerError: If the server returns a 5xx error.
|
| 768 |
"""
|
| 769 |
-
body:
|
| 770 |
k: v
|
| 771 |
for k, v in {
|
| 772 |
"name": name,
|
|
@@ -798,7 +797,7 @@ class AsyncConnect:
|
|
| 798 |
self,
|
| 799 |
id: str,
|
| 800 |
*,
|
| 801 |
-
request_options:
|
| 802 |
) -> None:
|
| 803 |
"""Delete a Connect Application
|
| 804 |
|
|
@@ -824,8 +823,8 @@ class AsyncConnect:
|
|
| 824 |
self,
|
| 825 |
id: str,
|
| 826 |
*,
|
| 827 |
-
request_options:
|
| 828 |
-
) ->
|
| 829 |
"""List Client Secrets for a Connect Application
|
| 830 |
|
| 831 |
List all client secrets associated with a Connect Application.
|
|
@@ -849,7 +848,7 @@ class AsyncConnect:
|
|
| 849 |
request_options=request_options,
|
| 850 |
)
|
| 851 |
return [
|
| 852 |
-
ApplicationCredentialsListItem.from_dict(cast(
|
| 853 |
for item in raw
|
| 854 |
]
|
| 855 |
|
|
@@ -857,7 +856,7 @@ class AsyncConnect:
|
|
| 857 |
self,
|
| 858 |
id: str,
|
| 859 |
*,
|
| 860 |
-
request_options:
|
| 861 |
) -> NewConnectApplicationSecret:
|
| 862 |
"""Create a new client secret for a Connect Application
|
| 863 |
|
|
@@ -877,7 +876,7 @@ class AsyncConnect:
|
|
| 877 |
RateLimitExceededError: If rate limited (429).
|
| 878 |
ServerError: If the server returns a 5xx error.
|
| 879 |
"""
|
| 880 |
-
body:
|
| 881 |
return await self._client.request(
|
| 882 |
method="post",
|
| 883 |
path=("connect", "applications", str(id), "client_secrets"),
|
|
@@ -890,7 +889,7 @@ class AsyncConnect:
|
|
| 890 |
self,
|
| 891 |
id: str,
|
| 892 |
*,
|
| 893 |
-
request_options:
|
| 894 |
) -> None:
|
| 895 |
"""Delete a Client Secret
|
| 896 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any, cast
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.connect_application import (
|
| 11 |
+
ConnectApplication,
|
| 12 |
+
ConnectApplicationVariant,
|
| 13 |
+
)
|
| 14 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 15 |
+
|
| 16 |
+
from .._pagination import AsyncPage, SyncPage
|
| 17 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 18 |
from .models import (
|
| 19 |
ApplicationCredentialsListItem,
|
| 20 |
+
ApplicationsRegistrationTypes,
|
| 21 |
CreateM2MApplication,
|
| 22 |
CreateOAuthApplication,
|
| 23 |
ExternalAuthCompleteResponse,
|
|
|
|
| 26 |
UserConsentOption,
|
| 27 |
UserObject,
|
| 28 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
class Connect:
|
| 32 |
"""Connect API resources."""
|
| 33 |
|
| 34 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 35 |
self._client = client
|
| 36 |
|
| 37 |
def complete_oauth2(
|
|
|
|
| 39 |
*,
|
| 40 |
external_auth_id: str,
|
| 41 |
user: UserObject,
|
| 42 |
+
user_consent_options: list[UserConsentOption] | None = None,
|
| 43 |
+
request_options: RequestOptions | None = None,
|
| 44 |
) -> ExternalAuthCompleteResponse:
|
| 45 |
"""Complete external authentication
|
| 46 |
|
|
|
|
| 72 |
RateLimitExceededError: If rate limited (429).
|
| 73 |
ServerError: If the server returns a 5xx error.
|
| 74 |
"""
|
| 75 |
+
body: dict[str, Any] = {
|
| 76 |
k: v
|
| 77 |
for k, v in {
|
| 78 |
"external_auth_id": external_auth_id,
|
|
|
|
| 96 |
def list_applications(
|
| 97 |
self,
|
| 98 |
*,
|
| 99 |
+
limit: int | None = None,
|
| 100 |
+
before: str | None = None,
|
| 101 |
+
after: str | None = None,
|
| 102 |
+
order: PaginationOrder | str | None = "desc",
|
|
|
|
| 103 |
+
registration_types: list[ApplicationsRegistrationTypes | str] | None = None,
|
|
|
|
| 104 |
+
organization_id: str | None = None,
|
| 105 |
+
request_options: RequestOptions | None = None,
|
| 106 |
) -> SyncPage[ConnectApplicationVariant]:
|
| 107 |
"""List Connect Applications
|
| 108 |
|
|
|
|
| 154 |
def create_application(
|
| 155 |
self,
|
| 156 |
*,
|
| 157 |
+
body: CreateOAuthApplication | CreateM2MApplication | dict[str, Any],
|
| 158 |
+
request_options: RequestOptions | None = None,
|
| 159 |
) -> ConnectApplicationVariant:
|
| 160 |
"""Create a Connect Application
|
| 161 |
|
|
|
|
| 175 |
RateLimitExceededError: If rate limited (429).
|
| 176 |
ServerError: If the server returns a 5xx error.
|
| 177 |
"""
|
| 178 |
+
_body: dict[str, Any] = body if isinstance(body, dict) else body.to_dict()
|
| 179 |
return cast(
|
| 180 |
ConnectApplicationVariant,
|
| 181 |
self._client.request(
|
|
|
|
| 192 |
*,
|
| 193 |
name: str,
|
| 194 |
is_first_party: bool,
|
| 195 |
+
description: str | None = None,
|
| 196 |
+
scopes: list[str] | None = None,
|
| 197 |
+
redirect_uris: list[RedirectUriInput] | None = None,
|
| 198 |
+
uses_pkce: bool | None = None,
|
| 199 |
+
organization_id: str | None = None,
|
| 200 |
+
request_options: RequestOptions | None = None,
|
| 201 |
) -> ConnectApplicationVariant:
|
| 202 |
"""Create oauth application."""
|
| 203 |
+
body: dict[str, Any] = {
|
| 204 |
"application_type": "oauth",
|
| 205 |
"name": name,
|
| 206 |
"is_first_party": is_first_party,
|
|
|
|
| 232 |
*,
|
| 233 |
name: str,
|
| 234 |
organization_id: str,
|
| 235 |
+
description: str | None = None,
|
| 236 |
+
scopes: list[str] | None = None,
|
| 237 |
+
request_options: RequestOptions | None = None,
|
| 238 |
) -> ConnectApplicationVariant:
|
| 239 |
"""Create m2m application."""
|
| 240 |
+
body: dict[str, Any] = {
|
| 241 |
"application_type": "m2m",
|
| 242 |
"name": name,
|
| 243 |
"organization_id": organization_id,
|
|
|
|
| 262 |
self,
|
| 263 |
id: str,
|
| 264 |
*,
|
| 265 |
+
request_options: RequestOptions | None = None,
|
| 266 |
) -> ConnectApplicationVariant:
|
| 267 |
"""Get a Connect Application
|
| 268 |
|
|
|
|
| 295 |
self,
|
| 296 |
id: str,
|
| 297 |
*,
|
| 298 |
+
name: str | None = None,
|
| 299 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 300 |
+
scopes: list[str] | None | NotGiven = NOT_GIVEN,
|
| 301 |
+
redirect_uris: list[RedirectUriInput] | None | NotGiven = NOT_GIVEN,
|
| 302 |
+
request_options: RequestOptions | None = None,
|
| 303 |
) -> ConnectApplicationVariant:
|
| 304 |
"""Update a Connect Application
|
| 305 |
|
|
|
|
| 323 |
RateLimitExceededError: If rate limited (429).
|
| 324 |
ServerError: If the server returns a 5xx error.
|
| 325 |
"""
|
| 326 |
+
body: dict[str, Any] = {
|
| 327 |
k: v
|
| 328 |
for k, v in {
|
| 329 |
"name": name,
|
|
|
|
| 355 |
self,
|
| 356 |
id: str,
|
| 357 |
*,
|
| 358 |
+
request_options: RequestOptions | None = None,
|
| 359 |
) -> None:
|
| 360 |
"""Delete a Connect Application
|
| 361 |
|
|
|
|
| 381 |
self,
|
| 382 |
id: str,
|
| 383 |
*,
|
| 384 |
+
request_options: RequestOptions | None = None,
|
| 385 |
+
) -> list[ApplicationCredentialsListItem]:
|
| 386 |
"""List Client Secrets for a Connect Application
|
| 387 |
|
| 388 |
List all client secrets associated with a Connect Application.
|
|
|
|
| 406 |
request_options=request_options,
|
| 407 |
)
|
| 408 |
return [
|
| 409 |
+
ApplicationCredentialsListItem.from_dict(cast(dict[str, Any], item))
|
| 410 |
for item in raw
|
| 411 |
]
|
| 412 |
|
|
|
|
| 414 |
self,
|
| 415 |
id: str,
|
| 416 |
*,
|
| 417 |
+
request_options: RequestOptions | None = None,
|
| 418 |
) -> NewConnectApplicationSecret:
|
| 419 |
"""Create a new client secret for a Connect Application
|
| 420 |
|
|
|
|
| 434 |
RateLimitExceededError: If rate limited (429).
|
| 435 |
ServerError: If the server returns a 5xx error.
|
| 436 |
"""
|
| 437 |
+
body: dict[str, Any] = {}
|
| 438 |
return self._client.request(
|
| 439 |
method="post",
|
| 440 |
path=("connect", "applications", str(id), "client_secrets"),
|
|
|
|
| 447 |
self,
|
| 448 |
id: str,
|
| 449 |
*,
|
| 450 |
+
request_options: RequestOptions | None = None,
|
| 451 |
) -> None:
|
| 452 |
"""Delete a Client Secret
|
| 453 |
|
|
|
|
| 473 |
class AsyncConnect:
|
| 474 |
"""Connect API resources (async)."""
|
| 475 |
|
| 476 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 477 |
self._client = client
|
| 478 |
|
| 479 |
async def complete_oauth2(
|
|
|
|
| 481 |
*,
|
| 482 |
external_auth_id: str,
|
| 483 |
user: UserObject,
|
| 484 |
+
user_consent_options: list[UserConsentOption] | None = None,
|
| 485 |
+
request_options: RequestOptions | None = None,
|
| 486 |
) -> ExternalAuthCompleteResponse:
|
| 487 |
"""Complete external authentication
|
| 488 |
|
|
|
|
| 514 |
RateLimitExceededError: If rate limited (429).
|
| 515 |
ServerError: If the server returns a 5xx error.
|
| 516 |
"""
|
| 517 |
+
body: dict[str, Any] = {
|
| 518 |
k: v
|
| 519 |
for k, v in {
|
| 520 |
"external_auth_id": external_auth_id,
|
|
|
|
| 538 |
async def list_applications(
|
| 539 |
self,
|
| 540 |
*,
|
| 541 |
+
limit: int | None = None,
|
| 542 |
+
before: str | None = None,
|
| 543 |
+
after: str | None = None,
|
| 544 |
+
order: PaginationOrder | str | None = "desc",
|
|
|
|
| 545 |
+
registration_types: list[ApplicationsRegistrationTypes | str] | None = None,
|
|
|
|
| 546 |
+
organization_id: str | None = None,
|
| 547 |
+
request_options: RequestOptions | None = None,
|
| 548 |
) -> AsyncPage[ConnectApplicationVariant]:
|
| 549 |
"""List Connect Applications
|
| 550 |
|
|
|
|
| 596 |
async def create_application(
|
| 597 |
self,
|
| 598 |
*,
|
| 599 |
+
body: CreateOAuthApplication | CreateM2MApplication | dict[str, Any],
|
| 600 |
+
request_options: RequestOptions | None = None,
|
| 601 |
) -> ConnectApplicationVariant:
|
| 602 |
"""Create a Connect Application
|
| 603 |
|
|
|
|
| 617 |
RateLimitExceededError: If rate limited (429).
|
| 618 |
ServerError: If the server returns a 5xx error.
|
| 619 |
"""
|
| 620 |
+
_body: dict[str, Any] = body if isinstance(body, dict) else body.to_dict()
|
| 621 |
return cast(
|
| 622 |
ConnectApplicationVariant,
|
| 623 |
await self._client.request(
|
|
|
|
| 634 |
*,
|
| 635 |
name: str,
|
| 636 |
is_first_party: bool,
|
| 637 |
+
description: str | None = None,
|
| 638 |
+
scopes: list[str] | None = None,
|
| 639 |
+
redirect_uris: list[RedirectUriInput] | None = None,
|
| 640 |
+
uses_pkce: bool | None = None,
|
| 641 |
+
organization_id: str | None = None,
|
| 642 |
+
request_options: RequestOptions | None = None,
|
| 643 |
) -> ConnectApplicationVariant:
|
| 644 |
"""Create oauth application."""
|
| 645 |
+
body: dict[str, Any] = {
|
| 646 |
"application_type": "oauth",
|
| 647 |
"name": name,
|
| 648 |
"is_first_party": is_first_party,
|
|
|
|
| 674 |
*,
|
| 675 |
name: str,
|
| 676 |
organization_id: str,
|
| 677 |
+
description: str | None = None,
|
| 678 |
+
scopes: list[str] | None = None,
|
| 679 |
+
request_options: RequestOptions | None = None,
|
| 680 |
) -> ConnectApplicationVariant:
|
| 681 |
"""Create m2m application."""
|
| 682 |
+
body: dict[str, Any] = {
|
| 683 |
"application_type": "m2m",
|
| 684 |
"name": name,
|
| 685 |
"organization_id": organization_id,
|
|
|
|
| 704 |
self,
|
| 705 |
id: str,
|
| 706 |
*,
|
| 707 |
+
request_options: RequestOptions | None = None,
|
| 708 |
) -> ConnectApplicationVariant:
|
| 709 |
"""Get a Connect Application
|
| 710 |
|
|
|
|
| 737 |
self,
|
| 738 |
id: str,
|
| 739 |
*,
|
| 740 |
+
name: str | None = None,
|
| 741 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 742 |
+
scopes: list[str] | None | NotGiven = NOT_GIVEN,
|
| 743 |
+
redirect_uris: list[RedirectUriInput] | None | NotGiven = NOT_GIVEN,
|
| 744 |
+
request_options: RequestOptions | None = None,
|
| 745 |
) -> ConnectApplicationVariant:
|
| 746 |
"""Update a Connect Application
|
| 747 |
|
|
|
|
| 765 |
RateLimitExceededError: If rate limited (429).
|
| 766 |
ServerError: If the server returns a 5xx error.
|
| 767 |
"""
|
| 768 |
+
body: dict[str, Any] = {
|
| 769 |
k: v
|
| 770 |
for k, v in {
|
| 771 |
"name": name,
|
|
|
|
| 797 |
self,
|
| 798 |
id: str,
|
| 799 |
*,
|
| 800 |
+
request_options: RequestOptions | None = None,
|
| 801 |
) -> None:
|
| 802 |
"""Delete a Connect Application
|
| 803 |
|
|
|
|
| 823 |
self,
|
| 824 |
id: str,
|
| 825 |
*,
|
| 826 |
+
request_options: RequestOptions | None = None,
|
| 827 |
+
) -> list[ApplicationCredentialsListItem]:
|
| 828 |
"""List Client Secrets for a Connect Application
|
| 829 |
|
| 830 |
List all client secrets associated with a Connect Application.
|
|
|
|
| 848 |
request_options=request_options,
|
| 849 |
)
|
| 850 |
return [
|
| 851 |
+
ApplicationCredentialsListItem.from_dict(cast(dict[str, Any], item))
|
| 852 |
for item in raw
|
| 853 |
]
|
| 854 |
|
|
|
|
| 856 |
self,
|
| 857 |
id: str,
|
| 858 |
*,
|
| 859 |
+
request_options: RequestOptions | None = None,
|
| 860 |
) -> NewConnectApplicationSecret:
|
| 861 |
"""Create a new client secret for a Connect Application
|
| 862 |
|
|
|
|
| 876 |
RateLimitExceededError: If rate limited (429).
|
| 877 |
ServerError: If the server returns a 5xx error.
|
| 878 |
"""
|
| 879 |
+
body: dict[str, Any] = {}
|
| 880 |
return await self._client.request(
|
| 881 |
method="post",
|
| 882 |
path=("connect", "applications", str(id), "client_secrets"),
|
|
|
|
| 889 |
self,
|
| 890 |
id: str,
|
| 891 |
*,
|
| 892 |
+
request_options: RequestOptions | None = None,
|
| 893 |
) -> None:
|
| 894 |
"""Delete a Client Secret
|
| 895 |
|
python/src/workos/connect/models/application_credentials_list_item.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -19,7 +19,7 @@ class ApplicationCredentialsListItem:
|
|
| 19 |
"""The unique ID of the client secret."""
|
| 20 |
secret_hint: str
|
| 21 |
"""A hint showing the last few characters of the secret value."""
|
| 22 |
-
last_used_at:
|
| 23 |
"""The timestamp when the client secret was last used, or null if never used."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
|
@@ -27,7 +27,7 @@ class ApplicationCredentialsListItem:
|
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -43,9 +43,9 @@ class ApplicationCredentialsListItem:
|
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("ApplicationCredentialsListItem", e)
|
| 45 |
|
| 46 |
-
def to_dict(self) ->
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
-
result:
|
| 49 |
result["object"] = self.object
|
| 50 |
result["id"] = self.id
|
| 51 |
result["secret_hint"] = self.secret_hint
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 19 |
"""The unique ID of the client secret."""
|
| 20 |
secret_hint: str
|
| 21 |
"""A hint showing the last few characters of the secret value."""
|
| 22 |
+
last_used_at: datetime | None
|
| 23 |
"""The timestamp when the client secret was last used, or null if never used."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 27 |
"""An ISO 8601 timestamp."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> ApplicationCredentialsListItem:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 43 |
except (KeyError, ValueError) as e:
|
| 44 |
_raise_deserialize_error("ApplicationCredentialsListItem", e)
|
| 45 |
|
| 46 |
+
def to_dict(self) -> dict[str, Any]:
|
| 47 |
"""Serialize to a dictionary."""
|
| 48 |
+
result: dict[str, Any] = {}
|
| 49 |
result["object"] = self.object
|
| 50 |
result["id"] = self.id
|
| 51 |
result["secret_hint"] = self.secret_hint
|
python/src/workos/connect/models/applications_registration_types.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class ApplicationsRegistrationTypes(str, Enum):
|
|
| 16 |
AUTHENTICATED = "authenticated"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
AUTHENTICATED = "authenticated"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> ApplicationsRegistrationTypes | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/connect/models/create_application_secret.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -12,14 +13,14 @@ class CreateApplicationSecret:
|
|
| 12 |
"""Create Application Secret model."""
|
| 13 |
|
| 14 |
@classmethod
|
| 15 |
-
def from_dict(cls, data:
|
| 16 |
"""Deserialize from a dictionary."""
|
| 17 |
try:
|
| 18 |
return cls()
|
| 19 |
except (KeyError, ValueError) as e:
|
| 20 |
_raise_deserialize_error("CreateApplicationSecret", e)
|
| 21 |
|
| 22 |
-
def to_dict(self) ->
|
| 23 |
"""Serialize to a dictionary."""
|
| 24 |
-
result:
|
| 25 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 13 |
"""Create Application Secret model."""
|
| 14 |
|
| 15 |
@classmethod
|
| 16 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateApplicationSecret:
|
| 17 |
"""Deserialize from a dictionary."""
|
| 18 |
try:
|
| 19 |
return cls()
|
| 20 |
except (KeyError, ValueError) as e:
|
| 21 |
_raise_deserialize_error("CreateApplicationSecret", e)
|
| 22 |
|
| 23 |
+
def to_dict(self) -> dict[str, Any]:
|
| 24 |
"""Serialize to a dictionary."""
|
| 25 |
+
result: dict[str, Any] = {}
|
| 26 |
return result
|
python/src/workos/connect/models/create_m2m_application.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,13 +18,13 @@ class CreateM2MApplication:
|
|
| 17 |
"""The type of application to create."""
|
| 18 |
organization_id: str
|
| 19 |
"""The organization ID this application belongs to."""
|
| 20 |
-
description:
|
| 21 |
"""A description for the application."""
|
| 22 |
-
scopes:
|
| 23 |
"""The OAuth scopes granted to the application."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
|
@@ -36,9 +37,9 @@ class CreateM2MApplication:
|
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("CreateM2MApplication", e)
|
| 38 |
|
| 39 |
-
def to_dict(self) ->
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
-
result:
|
| 42 |
result["name"] = self.name
|
| 43 |
result["application_type"] = self.application_type
|
| 44 |
result["organization_id"] = self.organization_id
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The type of application to create."""
|
| 19 |
organization_id: str
|
| 20 |
"""The organization ID this application belongs to."""
|
| 21 |
+
description: str | None = None
|
| 22 |
"""A description for the application."""
|
| 23 |
+
scopes: list[str] | None = None
|
| 24 |
"""The OAuth scopes granted to the application."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateM2MApplication:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("CreateM2MApplication", e)
|
| 39 |
|
| 40 |
+
def to_dict(self) -> dict[str, Any]:
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
+
result: dict[str, Any] = {}
|
| 43 |
result["name"] = self.name
|
| 44 |
result["application_type"] = self.application_type
|
| 45 |
result["organization_id"] = self.organization_id
|
python/src/workos/connect/models/create_oauth_application.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .redirect_uri_input import RedirectUriInput
|
|
@@ -20,19 +20,19 @@ class CreateOAuthApplication:
|
|
| 20 |
"""The type of application to create."""
|
| 21 |
is_first_party: bool
|
| 22 |
"""Whether this is a first-party application. Third-party applications require an organization_id."""
|
| 23 |
-
description:
|
| 24 |
"""A description for the application."""
|
| 25 |
-
scopes:
|
| 26 |
"""The OAuth scopes granted to the application."""
|
| 27 |
-
redirect_uris:
|
| 28 |
"""Redirect URIs for the application."""
|
| 29 |
-
uses_pkce:
|
| 30 |
"""Whether the application uses PKCE (Proof Key for Code Exchange)."""
|
| 31 |
-
organization_id:
|
| 32 |
"""The organization ID this application belongs to. Required when is_first_party is false."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
-
def from_dict(cls, data:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -42,7 +42,7 @@ class CreateOAuthApplication:
|
|
| 42 |
description=data.get("description"),
|
| 43 |
scopes=data.get("scopes"),
|
| 44 |
redirect_uris=[
|
| 45 |
-
RedirectUriInput.from_dict(cast(
|
| 46 |
for item in cast(list[Any], _v_redirect_uris)
|
| 47 |
]
|
| 48 |
if (_v_redirect_uris := data.get("redirect_uris")) is not None
|
|
@@ -53,9 +53,9 @@ class CreateOAuthApplication:
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("CreateOAuthApplication", e)
|
| 55 |
|
| 56 |
-
def to_dict(self) ->
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
-
result:
|
| 59 |
result["name"] = self.name
|
| 60 |
result["application_type"] = self.application_type
|
| 61 |
result["is_first_party"] = self.is_first_party
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .redirect_uri_input import RedirectUriInput
|
|
|
|
| 20 |
"""The type of application to create."""
|
| 21 |
is_first_party: bool
|
| 22 |
"""Whether this is a first-party application. Third-party applications require an organization_id."""
|
| 23 |
+
description: str | None = None
|
| 24 |
"""A description for the application."""
|
| 25 |
+
scopes: list[str] | None = None
|
| 26 |
"""The OAuth scopes granted to the application."""
|
| 27 |
+
redirect_uris: list[RedirectUriInput] | None = None
|
| 28 |
"""Redirect URIs for the application."""
|
| 29 |
+
uses_pkce: bool | None = None
|
| 30 |
"""Whether the application uses PKCE (Proof Key for Code Exchange)."""
|
| 31 |
+
organization_id: str | None = None
|
| 32 |
"""The organization ID this application belongs to. Required when is_first_party is false."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateOAuthApplication:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 42 |
description=data.get("description"),
|
| 43 |
scopes=data.get("scopes"),
|
| 44 |
redirect_uris=[
|
| 45 |
+
RedirectUriInput.from_dict(cast(dict[str, Any], item))
|
| 46 |
for item in cast(list[Any], _v_redirect_uris)
|
| 47 |
]
|
| 48 |
if (_v_redirect_uris := data.get("redirect_uris")) is not None
|
|
|
|
| 53 |
except (KeyError, ValueError) as e:
|
| 54 |
_raise_deserialize_error("CreateOAuthApplication", e)
|
| 55 |
|
| 56 |
+
def to_dict(self) -> dict[str, Any]:
|
| 57 |
"""Serialize to a dictionary."""
|
| 58 |
+
result: dict[str, Any] = {}
|
| 59 |
result["name"] = self.name
|
| 60 |
result["application_type"] = self.application_type
|
| 61 |
result["is_first_party"] = self.is_first_party
|
python/src/workos/connect/models/external_auth_complete_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class ExternalAuthCompleteResponse:
|
|
| 15 |
"""URI to redirect the user back to AuthKit to complete the OAuth flow."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class ExternalAuthCompleteResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("ExternalAuthCompleteResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["redirect_uri"] = self.redirect_uri
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""URI to redirect the user back to AuthKit to complete the OAuth flow."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> ExternalAuthCompleteResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("ExternalAuthCompleteResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["redirect_uri"] = self.redirect_uri
|
| 32 |
return result
|
python/src/workos/connect/models/new_connect_application_secret.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any,
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -19,7 +19,7 @@ class NewConnectApplicationSecret:
|
|
| 19 |
"""The unique ID of the client secret."""
|
| 20 |
secret_hint: str
|
| 21 |
"""A hint showing the last few characters of the secret value."""
|
| 22 |
-
last_used_at:
|
| 23 |
"""The timestamp when the client secret was last used, or null if never used."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
|
@@ -29,7 +29,7 @@ class NewConnectApplicationSecret:
|
|
| 29 |
"""The plaintext secret value. Only returned at creation time and cannot be retrieved later."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
-
def from_dict(cls, data:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
@@ -46,9 +46,9 @@ class NewConnectApplicationSecret:
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("NewConnectApplicationSecret", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["secret_hint"] = self.secret_hint
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any, Literal
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 19 |
"""The unique ID of the client secret."""
|
| 20 |
secret_hint: str
|
| 21 |
"""A hint showing the last few characters of the secret value."""
|
| 22 |
+
last_used_at: datetime | None
|
| 23 |
"""The timestamp when the client secret was last used, or null if never used."""
|
| 24 |
created_at: datetime
|
| 25 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 29 |
"""The plaintext secret value. Only returned at creation time and cannot be retrieved later."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
+
def from_dict(cls, data: dict[str, Any]) -> NewConnectApplicationSecret:
|
| 33 |
"""Deserialize from a dictionary."""
|
| 34 |
try:
|
| 35 |
return cls(
|
|
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("NewConnectApplicationSecret", e)
|
| 48 |
|
| 49 |
+
def to_dict(self) -> dict[str, Any]:
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
+
result: dict[str, Any] = {}
|
| 52 |
result["object"] = self.object
|
| 53 |
result["id"] = self.id
|
| 54 |
result["secret_hint"] = self.secret_hint
|
python/src/workos/connect/models/redirect_uri_input.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,11 +14,11 @@ class RedirectUriInput:
|
|
| 13 |
|
| 14 |
uri: str
|
| 15 |
"""The redirect URI."""
|
| 16 |
-
default:
|
| 17 |
"""Whether this is the default redirect URI."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class RedirectUriInput:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("RedirectUriInput", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["uri"] = self.uri
|
| 34 |
if self.default is not None:
|
| 35 |
result["default"] = self.default
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
uri: str
|
| 16 |
"""The redirect URI."""
|
| 17 |
+
default: bool | None = None
|
| 18 |
"""Whether this is the default redirect URI."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> RedirectUriInput:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("RedirectUriInput", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["uri"] = self.uri
|
| 35 |
if self.default is not None:
|
| 36 |
result["default"] = self.default
|
python/src/workos/connect/models/update_oauth_application.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .redirect_uri_input import RedirectUriInput
|
|
@@ -14,17 +14,17 @@ from .redirect_uri_input import RedirectUriInput
|
|
| 14 |
class UpdateOAuthApplication:
|
| 15 |
"""Update O Auth Application model."""
|
| 16 |
|
| 17 |
-
name:
|
| 18 |
"""The name of the application."""
|
| 19 |
-
description:
|
| 20 |
"""A description for the application."""
|
| 21 |
-
scopes:
|
| 22 |
"""The OAuth scopes granted to the application."""
|
| 23 |
-
redirect_uris:
|
| 24 |
"""Updated redirect URIs for the application. OAuth applications only."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
-
def from_dict(cls, data:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
@@ -32,7 +32,7 @@ class UpdateOAuthApplication:
|
|
| 32 |
description=data.get("description"),
|
| 33 |
scopes=data.get("scopes"),
|
| 34 |
redirect_uris=[
|
| 35 |
-
RedirectUriInput.from_dict(cast(
|
| 36 |
for item in cast(list[Any], _v_redirect_uris)
|
| 37 |
]
|
| 38 |
if (_v_redirect_uris := data.get("redirect_uris")) is not None
|
|
@@ -41,9 +41,9 @@ class UpdateOAuthApplication:
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("UpdateOAuthApplication", e)
|
| 43 |
|
| 44 |
-
def to_dict(self) ->
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
-
result:
|
| 47 |
if self.name is not None:
|
| 48 |
result["name"] = self.name
|
| 49 |
if self.description is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .redirect_uri_input import RedirectUriInput
|
|
|
|
| 14 |
class UpdateOAuthApplication:
|
| 15 |
"""Update O Auth Application model."""
|
| 16 |
|
| 17 |
+
name: str | None = None
|
| 18 |
"""The name of the application."""
|
| 19 |
+
description: str | None = None
|
| 20 |
"""A description for the application."""
|
| 21 |
+
scopes: list[str] | None = None
|
| 22 |
"""The OAuth scopes granted to the application."""
|
| 23 |
+
redirect_uris: list[RedirectUriInput] | None = None
|
| 24 |
"""Updated redirect URIs for the application. OAuth applications only."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateOAuthApplication:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 32 |
description=data.get("description"),
|
| 33 |
scopes=data.get("scopes"),
|
| 34 |
redirect_uris=[
|
| 35 |
+
RedirectUriInput.from_dict(cast(dict[str, Any], item))
|
| 36 |
for item in cast(list[Any], _v_redirect_uris)
|
| 37 |
]
|
| 38 |
if (_v_redirect_uris := data.get("redirect_uris")) is not None
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("UpdateOAuthApplication", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
if self.name is not None:
|
| 48 |
result["name"] = self.name
|
| 49 |
if self.description is not None:
|
python/src/workos/connect/models/user_consent_option.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .user_consent_option_choice import UserConsentOptionChoice
|
|
@@ -20,11 +20,11 @@ class UserConsentOption:
|
|
| 20 |
"""The type of consent option."""
|
| 21 |
label: str
|
| 22 |
"""A human-readable label for this consent option."""
|
| 23 |
-
choices:
|
| 24 |
"""The available choices for this consent option."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
-
def from_dict(cls, data:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
@@ -32,16 +32,16 @@ class UserConsentOption:
|
|
| 32 |
type=data.get("type", "enum"),
|
| 33 |
label=data["label"],
|
| 34 |
choices=[
|
| 35 |
-
UserConsentOptionChoice.from_dict(cast(
|
| 36 |
for item in cast(list[Any], data["choices"])
|
| 37 |
],
|
| 38 |
)
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("UserConsentOption", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["claim"] = self.claim
|
| 46 |
result["type"] = self.type
|
| 47 |
result["label"] = self.label
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .user_consent_option_choice import UserConsentOptionChoice
|
|
|
|
| 20 |
"""The type of consent option."""
|
| 21 |
label: str
|
| 22 |
"""A human-readable label for this consent option."""
|
| 23 |
+
choices: list[UserConsentOptionChoice]
|
| 24 |
"""The available choices for this consent option."""
|
| 25 |
|
| 26 |
@classmethod
|
| 27 |
+
def from_dict(cls, data: dict[str, Any]) -> UserConsentOption:
|
| 28 |
"""Deserialize from a dictionary."""
|
| 29 |
try:
|
| 30 |
return cls(
|
|
|
|
| 32 |
type=data.get("type", "enum"),
|
| 33 |
label=data["label"],
|
| 34 |
choices=[
|
| 35 |
+
UserConsentOptionChoice.from_dict(cast(dict[str, Any], item))
|
| 36 |
for item in cast(list[Any], data["choices"])
|
| 37 |
],
|
| 38 |
)
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("UserConsentOption", e)
|
| 41 |
|
| 42 |
+
def to_dict(self) -> dict[str, Any]:
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
+
result: dict[str, Any] = {}
|
| 45 |
result["claim"] = self.claim
|
| 46 |
result["type"] = self.type
|
| 47 |
result["label"] = self.label
|
python/src/workos/connect/models/user_consent_option_choice.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,13 +12,13 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class UserConsentOptionChoice:
|
| 12 |
"""User Consent Option Choice model."""
|
| 13 |
|
| 14 |
-
value:
|
| 15 |
"""The value of this choice."""
|
| 16 |
-
label:
|
| 17 |
"""A human-readable label for this choice."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class UserConsentOptionChoice:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("UserConsentOptionChoice", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
if self.value is not None:
|
| 34 |
result["value"] = self.value
|
| 35 |
if self.label is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class UserConsentOptionChoice:
|
| 13 |
"""User Consent Option Choice model."""
|
| 14 |
|
| 15 |
+
value: str | None = None
|
| 16 |
"""The value of this choice."""
|
| 17 |
+
label: str | None = None
|
| 18 |
"""A human-readable label for this choice."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> UserConsentOptionChoice:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("UserConsentOptionChoice", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.value is not None:
|
| 35 |
result["value"] = self.value
|
| 36 |
if self.label is not None:
|
python/src/workos/connect/models/user_management_login_request.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .user_consent_option import UserConsentOption
|
|
@@ -17,20 +17,20 @@ class UserManagementLoginRequest:
|
|
| 17 |
|
| 18 |
external_auth_id: str
|
| 19 |
"""Identifier provided when AuthKit redirected to your login page."""
|
| 20 |
-
user:
|
| 21 |
"""The user to create or update in AuthKit."""
|
| 22 |
-
user_consent_options:
|
| 23 |
"""Array of [User Consent Options](https://workos.com/docs/reference/workos-connect/standalone/user-consent-options) to store with the session."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
external_auth_id=data["external_auth_id"],
|
| 31 |
-
user=UserObject.from_dict(cast(
|
| 32 |
user_consent_options=[
|
| 33 |
-
UserConsentOption.from_dict(cast(
|
| 34 |
for item in cast(list[Any], _v_user_consent_options)
|
| 35 |
]
|
| 36 |
if (_v_user_consent_options := data.get("user_consent_options"))
|
|
@@ -40,9 +40,9 @@ class UserManagementLoginRequest:
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("UserManagementLoginRequest", e)
|
| 42 |
|
| 43 |
-
def to_dict(self) ->
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
-
result:
|
| 46 |
result["external_auth_id"] = self.external_auth_id
|
| 47 |
result["user"] = self.user.to_dict()
|
| 48 |
if self.user_consent_options is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .user_consent_option import UserConsentOption
|
|
|
|
| 17 |
|
| 18 |
external_auth_id: str
|
| 19 |
"""Identifier provided when AuthKit redirected to your login page."""
|
| 20 |
+
user: UserObject
|
| 21 |
"""The user to create or update in AuthKit."""
|
| 22 |
+
user_consent_options: list[UserConsentOption] | None = None
|
| 23 |
"""Array of [User Consent Options](https://workos.com/docs/reference/workos-connect/standalone/user-consent-options) to store with the session."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> UserManagementLoginRequest:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
external_auth_id=data["external_auth_id"],
|
| 31 |
+
user=UserObject.from_dict(cast(dict[str, Any], data["user"])),
|
| 32 |
user_consent_options=[
|
| 33 |
+
UserConsentOption.from_dict(cast(dict[str, Any], item))
|
| 34 |
for item in cast(list[Any], _v_user_consent_options)
|
| 35 |
]
|
| 36 |
if (_v_user_consent_options := data.get("user_consent_options"))
|
|
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("UserManagementLoginRequest", e)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["external_auth_id"] = self.external_auth_id
|
| 47 |
result["user"] = self.user.to_dict()
|
| 48 |
if self.user_consent_options is not None:
|
python/src/workos/connect/models/user_object.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,17 +16,17 @@ class UserObject:
|
|
| 15 |
"""Your application's user identifier, which will be stored as an [`external_id`](https://workos.com/docs/authkit/metadata/external-identifiers). Used for upserting and deduplication."""
|
| 16 |
email: str
|
| 17 |
"""The user's email address."""
|
| 18 |
-
first_name:
|
| 19 |
"""The user's first name."""
|
| 20 |
-
last_name:
|
| 21 |
"""The user's last name."""
|
| 22 |
-
name:
|
| 23 |
"""The user's full name."""
|
| 24 |
-
metadata:
|
| 25 |
"""A set of key-value pairs to attach to the user."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(cls, data:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -39,9 +40,9 @@ class UserObject:
|
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("UserObject", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["id"] = self.id
|
| 46 |
result["email"] = self.email
|
| 47 |
if self.first_name is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Your application's user identifier, which will be stored as an [`external_id`](https://workos.com/docs/authkit/metadata/external-identifiers). Used for upserting and deduplication."""
|
| 17 |
email: str
|
| 18 |
"""The user's email address."""
|
| 19 |
+
first_name: str | None = None
|
| 20 |
"""The user's first name."""
|
| 21 |
+
last_name: str | None = None
|
| 22 |
"""The user's last name."""
|
| 23 |
+
name: str | None = None
|
| 24 |
"""The user's full name."""
|
| 25 |
+
metadata: dict[str, str] | None = None
|
| 26 |
"""A set of key-value pairs to attach to the user."""
|
| 27 |
|
| 28 |
@classmethod
|
| 29 |
+
def from_dict(cls, data: dict[str, Any]) -> UserObject:
|
| 30 |
"""Deserialize from a dictionary."""
|
| 31 |
try:
|
| 32 |
return cls(
|
|
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("UserObject", e)
|
| 42 |
|
| 43 |
+
def to_dict(self) -> dict[str, Any]:
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
+
result: dict[str, Any] = {}
|
| 46 |
result["id"] = self.id
|
| 47 |
result["email"] = self.email
|
| 48 |
if self.first_name is not None:
|
python/src/workos/directory_sync/_resource.py|
@@ -2,35 +2,36 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
-
from .models import Directory, DirectoryUserWithGroups
|
| 12 |
from workos.common.models.directory_group import DirectoryGroup
|
| 13 |
from workos.common.models.pagination_order import PaginationOrder
|
|
|
|
| 14 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
class DirectorySync:
|
| 18 |
"""Directory Sync API resources."""
|
| 19 |
|
| 20 |
-
def __init__(self, client:
|
| 21 |
self._client = client
|
| 22 |
|
| 23 |
def list_directories(
|
| 24 |
self,
|
| 25 |
*,
|
| 26 |
-
limit:
|
| 27 |
-
before:
|
| 28 |
-
after:
|
| 29 |
-
order:
|
| 30 |
-
organization_id:
|
| 31 |
-
search:
|
| 32 |
-
domain:
|
| 33 |
-
request_options:
|
| 34 |
) -> SyncPage[Directory]:
|
| 35 |
"""List Directories
|
| 36 |
|
|
@@ -81,7 +82,7 @@ class DirectorySync:
|
|
| 81 |
self,
|
| 82 |
id: str,
|
| 83 |
*,
|
| 84 |
-
request_options:
|
| 85 |
) -> Directory:
|
| 86 |
"""Get a Directory
|
| 87 |
|
|
@@ -112,7 +113,7 @@ class DirectorySync:
|
|
| 112 |
self,
|
| 113 |
id: str,
|
| 114 |
*,
|
| 115 |
-
request_options:
|
| 116 |
) -> None:
|
| 117 |
"""Delete a Directory
|
| 118 |
|
|
@@ -137,13 +138,13 @@ class DirectorySync:
|
|
| 137 |
def list_groups(
|
| 138 |
self,
|
| 139 |
*,
|
| 140 |
-
limit:
|
| 141 |
-
before:
|
| 142 |
-
after:
|
| 143 |
-
order:
|
| 144 |
-
directory:
|
| 145 |
-
user:
|
| 146 |
-
request_options:
|
| 147 |
) -> SyncPage[DirectoryGroup]:
|
| 148 |
"""List Directory Groups
|
| 149 |
|
|
@@ -193,7 +194,7 @@ class DirectorySync:
|
|
| 193 |
self,
|
| 194 |
id: str,
|
| 195 |
*,
|
| 196 |
-
request_options:
|
| 197 |
) -> DirectoryGroup:
|
| 198 |
"""Get a Directory Group
|
| 199 |
|
|
@@ -223,15 +224,15 @@ class DirectorySync:
|
|
| 223 |
def list_users(
|
| 224 |
self,
|
| 225 |
*,
|
| 226 |
-
limit:
|
| 227 |
-
before:
|
| 228 |
-
after:
|
| 229 |
-
order:
|
| 230 |
-
directory:
|
| 231 |
-
group:
|
| 232 |
-
idp_id:
|
| 233 |
-
email:
|
| 234 |
-
request_options:
|
| 235 |
) -> SyncPage[DirectoryUserWithGroups]:
|
| 236 |
"""List Directory Users
|
| 237 |
|
|
@@ -285,7 +286,7 @@ class DirectorySync:
|
|
| 285 |
self,
|
| 286 |
id: str,
|
| 287 |
*,
|
| 288 |
-
request_options:
|
| 289 |
) -> DirectoryUserWithGroups:
|
| 290 |
"""Get a Directory User
|
| 291 |
|
|
@@ -316,20 +317,20 @@ class DirectorySync:
|
|
| 316 |
class AsyncDirectorySync:
|
| 317 |
"""Directory Sync API resources (async)."""
|
| 318 |
|
| 319 |
-
def __init__(self, client:
|
| 320 |
self._client = client
|
| 321 |
|
| 322 |
async def list_directories(
|
| 323 |
self,
|
| 324 |
*,
|
| 325 |
-
limit:
|
| 326 |
-
before:
|
| 327 |
-
after:
|
| 328 |
-
order:
|
| 329 |
-
organization_id:
|
| 330 |
-
search:
|
| 331 |
-
domain:
|
| 332 |
-
request_options:
|
| 333 |
) -> AsyncPage[Directory]:
|
| 334 |
"""List Directories
|
| 335 |
|
|
@@ -380,7 +381,7 @@ class AsyncDirectorySync:
|
|
| 380 |
self,
|
| 381 |
id: str,
|
| 382 |
*,
|
| 383 |
-
request_options:
|
| 384 |
) -> Directory:
|
| 385 |
"""Get a Directory
|
| 386 |
|
|
@@ -411,7 +412,7 @@ class AsyncDirectorySync:
|
|
| 411 |
self,
|
| 412 |
id: str,
|
| 413 |
*,
|
| 414 |
-
request_options:
|
| 415 |
) -> None:
|
| 416 |
"""Delete a Directory
|
| 417 |
|
|
@@ -436,13 +437,13 @@ class AsyncDirectorySync:
|
|
| 436 |
async def list_groups(
|
| 437 |
self,
|
| 438 |
*,
|
| 439 |
-
limit:
|
| 440 |
-
before:
|
| 441 |
-
after:
|
| 442 |
-
order:
|
| 443 |
-
directory:
|
| 444 |
-
user:
|
| 445 |
-
request_options:
|
| 446 |
) -> AsyncPage[DirectoryGroup]:
|
| 447 |
"""List Directory Groups
|
| 448 |
|
|
@@ -492,7 +493,7 @@ class AsyncDirectorySync:
|
|
| 492 |
self,
|
| 493 |
id: str,
|
| 494 |
*,
|
| 495 |
-
request_options:
|
| 496 |
) -> DirectoryGroup:
|
| 497 |
"""Get a Directory Group
|
| 498 |
|
|
@@ -522,15 +523,15 @@ class AsyncDirectorySync:
|
|
| 522 |
async def list_users(
|
| 523 |
self,
|
| 524 |
*,
|
| 525 |
-
limit:
|
| 526 |
-
before:
|
| 527 |
-
after:
|
| 528 |
-
order:
|
| 529 |
-
directory:
|
| 530 |
-
group:
|
| 531 |
-
idp_id:
|
| 532 |
-
email:
|
| 533 |
-
request_options:
|
| 534 |
) -> AsyncPage[DirectoryUserWithGroups]:
|
| 535 |
"""List Directory Users
|
| 536 |
|
|
@@ -584,7 +585,7 @@ class AsyncDirectorySync:
|
|
| 584 |
self,
|
| 585 |
id: str,
|
| 586 |
*,
|
| 587 |
-
request_options:
|
| 588 |
) -> DirectoryUserWithGroups:
|
| 589 |
"""Get a Directory User
|
| 590 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
| 10 |
from workos.common.models.directory_group import DirectoryGroup
|
| 11 |
from workos.common.models.pagination_order import PaginationOrder
|
| 12 |
+
|
| 13 |
from .._pagination import AsyncPage, SyncPage
|
| 14 |
+
from .._types import RequestOptions, enum_value
|
| 15 |
+
from .models import Directory, DirectoryUserWithGroups
|
| 16 |
|
| 17 |
|
| 18 |
class DirectorySync:
|
| 19 |
"""Directory Sync API resources."""
|
| 20 |
|
| 21 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 22 |
self._client = client
|
| 23 |
|
| 24 |
def list_directories(
|
| 25 |
self,
|
| 26 |
*,
|
| 27 |
+
limit: int | None = None,
|
| 28 |
+
before: str | None = None,
|
| 29 |
+
after: str | None = None,
|
| 30 |
+
order: PaginationOrder | str | None = "desc",
|
| 31 |
+
organization_id: str | None = None,
|
| 32 |
+
search: str | None = None,
|
| 33 |
+
domain: str | None = None,
|
| 34 |
+
request_options: RequestOptions | None = None,
|
| 35 |
) -> SyncPage[Directory]:
|
| 36 |
"""List Directories
|
| 37 |
|
|
|
|
| 82 |
self,
|
| 83 |
id: str,
|
| 84 |
*,
|
| 85 |
+
request_options: RequestOptions | None = None,
|
| 86 |
) -> Directory:
|
| 87 |
"""Get a Directory
|
| 88 |
|
|
|
|
| 113 |
self,
|
| 114 |
id: str,
|
| 115 |
*,
|
| 116 |
+
request_options: RequestOptions | None = None,
|
| 117 |
) -> None:
|
| 118 |
"""Delete a Directory
|
| 119 |
|
|
|
|
| 138 |
def list_groups(
|
| 139 |
self,
|
| 140 |
*,
|
| 141 |
+
limit: int | None = None,
|
| 142 |
+
before: str | None = None,
|
| 143 |
+
after: str | None = None,
|
| 144 |
+
order: PaginationOrder | str | None = "desc",
|
| 145 |
+
directory: str | None = None,
|
| 146 |
+
user: str | None = None,
|
| 147 |
+
request_options: RequestOptions | None = None,
|
| 148 |
) -> SyncPage[DirectoryGroup]:
|
| 149 |
"""List Directory Groups
|
| 150 |
|
|
|
|
| 194 |
self,
|
| 195 |
id: str,
|
| 196 |
*,
|
| 197 |
+
request_options: RequestOptions | None = None,
|
| 198 |
) -> DirectoryGroup:
|
| 199 |
"""Get a Directory Group
|
| 200 |
|
|
|
|
| 224 |
def list_users(
|
| 225 |
self,
|
| 226 |
*,
|
| 227 |
+
limit: int | None = None,
|
| 228 |
+
before: str | None = None,
|
| 229 |
+
after: str | None = None,
|
| 230 |
+
order: PaginationOrder | str | None = "desc",
|
| 231 |
+
directory: str | None = None,
|
| 232 |
+
group: str | None = None,
|
| 233 |
+
idp_id: str | None = None,
|
| 234 |
+
email: str | None = None,
|
| 235 |
+
request_options: RequestOptions | None = None,
|
| 236 |
) -> SyncPage[DirectoryUserWithGroups]:
|
| 237 |
"""List Directory Users
|
| 238 |
|
|
|
|
| 286 |
self,
|
| 287 |
id: str,
|
| 288 |
*,
|
| 289 |
+
request_options: RequestOptions | None = None,
|
| 290 |
) -> DirectoryUserWithGroups:
|
| 291 |
"""Get a Directory User
|
| 292 |
|
|
|
|
| 317 |
class AsyncDirectorySync:
|
| 318 |
"""Directory Sync API resources (async)."""
|
| 319 |
|
| 320 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 321 |
self._client = client
|
| 322 |
|
| 323 |
async def list_directories(
|
| 324 |
self,
|
| 325 |
*,
|
| 326 |
+
limit: int | None = None,
|
| 327 |
+
before: str | None = None,
|
| 328 |
+
after: str | None = None,
|
| 329 |
+
order: PaginationOrder | str | None = "desc",
|
| 330 |
+
organization_id: str | None = None,
|
| 331 |
+
search: str | None = None,
|
| 332 |
+
domain: str | None = None,
|
| 333 |
+
request_options: RequestOptions | None = None,
|
| 334 |
) -> AsyncPage[Directory]:
|
| 335 |
"""List Directories
|
| 336 |
|
|
|
|
| 381 |
self,
|
| 382 |
id: str,
|
| 383 |
*,
|
| 384 |
+
request_options: RequestOptions | None = None,
|
| 385 |
) -> Directory:
|
| 386 |
"""Get a Directory
|
| 387 |
|
|
|
|
| 412 |
self,
|
| 413 |
id: str,
|
| 414 |
*,
|
| 415 |
+
request_options: RequestOptions | None = None,
|
| 416 |
) -> None:
|
| 417 |
"""Delete a Directory
|
| 418 |
|
|
|
|
| 437 |
async def list_groups(
|
| 438 |
self,
|
| 439 |
*,
|
| 440 |
+
limit: int | None = None,
|
| 441 |
+
before: str | None = None,
|
| 442 |
+
after: str | None = None,
|
| 443 |
+
order: PaginationOrder | str | None = "desc",
|
| 444 |
+
directory: str | None = None,
|
| 445 |
+
user: str | None = None,
|
| 446 |
+
request_options: RequestOptions | None = None,
|
| 447 |
) -> AsyncPage[DirectoryGroup]:
|
| 448 |
"""List Directory Groups
|
| 449 |
|
|
|
|
| 493 |
self,
|
| 494 |
id: str,
|
| 495 |
*,
|
| 496 |
+
request_options: RequestOptions | None = None,
|
| 497 |
) -> DirectoryGroup:
|
| 498 |
"""Get a Directory Group
|
| 499 |
|
|
|
|
| 523 |
async def list_users(
|
| 524 |
self,
|
| 525 |
*,
|
| 526 |
+
limit: int | None = None,
|
| 527 |
+
before: str | None = None,
|
| 528 |
+
after: str | None = None,
|
| 529 |
+
order: PaginationOrder | str | None = "desc",
|
| 530 |
+
directory: str | None = None,
|
| 531 |
+
group: str | None = None,
|
| 532 |
+
idp_id: str | None = None,
|
| 533 |
+
email: str | None = None,
|
| 534 |
+
request_options: RequestOptions | None = None,
|
| 535 |
) -> AsyncPage[DirectoryUserWithGroups]:
|
| 536 |
"""List Directory Users
|
| 537 |
|
|
|
|
| 585 |
self,
|
| 586 |
id: str,
|
| 587 |
*,
|
| 588 |
+
request_options: RequestOptions | None = None,
|
| 589 |
) -> DirectoryUserWithGroups:
|
| 590 |
"""Get a Directory User
|
| 591 |
|
python/src/workos/directory_sync/models/directory.py|
@@ -5,15 +5,14 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
from workos._types import _raise_deserialize_error
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
-
from .
|
| 14 |
from workos.common.models.directory_state import DirectoryState
|
| 15 |
from workos.common.models.directory_type import DirectoryType
|
| 16 |
|
|
|
|
|
|
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
| 19 |
class Directory:
|
|
@@ -27,9 +26,9 @@ class Directory:
|
|
| 27 |
"""The unique identifier for the Organization in which the directory resides."""
|
| 28 |
external_key: str
|
| 29 |
"""External Key for the Directory."""
|
| 30 |
-
type:
|
| 31 |
"""The type of external Directory Provider integrated with."""
|
| 32 |
-
state:
|
| 33 |
"""Describes whether the Directory has been successfully connected to an external provider."""
|
| 34 |
name: str
|
| 35 |
"""The name of the directory."""
|
|
@@ -37,13 +36,13 @@ class Directory:
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
updated_at: datetime
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
-
domain:
|
| 41 |
"""The URL associated with an Enterprise Client."""
|
| 42 |
-
metadata:
|
| 43 |
"""Aggregate counts of directory users and groups synced from the provider."""
|
| 44 |
|
| 45 |
@classmethod
|
| 46 |
-
def from_dict(cls, data:
|
| 47 |
"""Deserialize from a dictionary."""
|
| 48 |
try:
|
| 49 |
return cls(
|
|
@@ -57,16 +56,16 @@ class Directory:
|
|
| 57 |
created_at=_parse_datetime(data["created_at"]),
|
| 58 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 59 |
domain=data.get("domain"),
|
| 60 |
-
metadata=DirectoryMetadata.from_dict(cast(
|
| 61 |
if (_v_metadata := data.get("metadata")) is not None
|
| 62 |
else None,
|
| 63 |
)
|
| 64 |
except (KeyError, ValueError) as e:
|
| 65 |
_raise_deserialize_error("Directory", e)
|
| 66 |
|
| 67 |
-
def to_dict(self) ->
|
| 68 |
"""Serialize to a dictionary."""
|
| 69 |
-
result:
|
| 70 |
result["object"] = self.object
|
| 71 |
result["id"] = self.id
|
| 72 |
result["organization_id"] = self.organization_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.directory_state import DirectoryState
|
| 12 |
from workos.common.models.directory_type import DirectoryType
|
| 13 |
|
| 14 |
+
from .directory_metadata import DirectoryMetadata
|
| 15 |
+
|
| 16 |
|
| 17 |
@dataclass(slots=True)
|
| 18 |
class Directory:
|
|
|
|
| 26 |
"""The unique identifier for the Organization in which the directory resides."""
|
| 27 |
external_key: str
|
| 28 |
"""External Key for the Directory."""
|
| 29 |
+
type: DirectoryType
|
| 30 |
"""The type of external Directory Provider integrated with."""
|
| 31 |
+
state: DirectoryState
|
| 32 |
"""Describes whether the Directory has been successfully connected to an external provider."""
|
| 33 |
name: str
|
| 34 |
"""The name of the directory."""
|
|
|
|
| 36 |
"""An ISO 8601 timestamp."""
|
| 37 |
updated_at: datetime
|
| 38 |
"""An ISO 8601 timestamp."""
|
| 39 |
+
domain: str | None = None
|
| 40 |
"""The URL associated with an Enterprise Client."""
|
| 41 |
+
metadata: DirectoryMetadata | None = None
|
| 42 |
"""Aggregate counts of directory users and groups synced from the provider."""
|
| 43 |
|
| 44 |
@classmethod
|
| 45 |
+
def from_dict(cls, data: dict[str, Any]) -> Directory:
|
| 46 |
"""Deserialize from a dictionary."""
|
| 47 |
try:
|
| 48 |
return cls(
|
|
|
|
| 56 |
created_at=_parse_datetime(data["created_at"]),
|
| 57 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 58 |
domain=data.get("domain"),
|
| 59 |
+
metadata=DirectoryMetadata.from_dict(cast(dict[str, Any], _v_metadata))
|
| 60 |
if (_v_metadata := data.get("metadata")) is not None
|
| 61 |
else None,
|
| 62 |
)
|
| 63 |
except (KeyError, ValueError) as e:
|
| 64 |
_raise_deserialize_error("Directory", e)
|
| 65 |
|
| 66 |
+
def to_dict(self) -> dict[str, Any]:
|
| 67 |
"""Serialize to a dictionary."""
|
| 68 |
+
result: dict[str, Any] = {}
|
| 69 |
result["object"] = self.object
|
| 70 |
result["id"] = self.id
|
| 71 |
result["organization_id"] = self.organization_id
|
python/src/workos/directory_sync/models/directory_metadata.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .directory_metadata_user import DirectoryMetadataUser
|
|
@@ -14,27 +14,27 @@ from .directory_metadata_user import DirectoryMetadataUser
|
|
| 14 |
class DirectoryMetadata:
|
| 15 |
"""Aggregate counts of directory users and groups synced from the provider."""
|
| 16 |
|
| 17 |
-
users:
|
| 18 |
"""Counts of active and inactive directory users."""
|
| 19 |
groups: int
|
| 20 |
"""Count of directory groups."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
users=DirectoryMetadataUser.from_dict(
|
| 28 |
-
cast(
|
| 29 |
),
|
| 30 |
groups=data["groups"],
|
| 31 |
)
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("DirectoryMetadata", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["users"] = self.users.to_dict()
|
| 39 |
result["groups"] = self.groups
|
| 40 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .directory_metadata_user import DirectoryMetadataUser
|
|
|
|
| 14 |
class DirectoryMetadata:
|
| 15 |
"""Aggregate counts of directory users and groups synced from the provider."""
|
| 16 |
|
| 17 |
+
users: DirectoryMetadataUser
|
| 18 |
"""Counts of active and inactive directory users."""
|
| 19 |
groups: int
|
| 20 |
"""Count of directory groups."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryMetadata:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
users=DirectoryMetadataUser.from_dict(
|
| 28 |
+
cast(dict[str, Any], data["users"])
|
| 29 |
),
|
| 30 |
groups=data["groups"],
|
| 31 |
)
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("DirectoryMetadata", e)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["users"] = self.users.to_dict()
|
| 39 |
result["groups"] = self.groups
|
| 40 |
return result
|
python/src/workos/directory_sync/models/directory_metadata_user.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class DirectoryMetadataUser:
|
|
| 17 |
"""Count of inactive directory users."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class DirectoryMetadataUser:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("DirectoryMetadataUser", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["active"] = self.active
|
| 34 |
result["inactive"] = self.inactive
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""Count of inactive directory users."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryMetadataUser:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("DirectoryMetadataUser", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["active"] = self.active
|
| 35 |
result["inactive"] = self.inactive
|
| 36 |
return result
|
python/src/workos/directory_sync/models/directory_user_with_groups.py|
@@ -5,17 +5,16 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
from workos._types import _raise_deserialize_error
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
|
|
|
| 13 |
from workos.common.models.directory_group import DirectoryGroup
|
| 14 |
-
from .directory_user_with_groups_email import DirectoryUserWithGroupsEmail
|
| 15 |
-
from workos.common.models.slim_role import SlimRole
|
| 16 |
from workos.common.models.directory_user_with_groups_state import (
|
| 17 |
DirectoryUserWithGroupsState,
|
| 18 |
)
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
@dataclass(slots=True)
|
|
@@ -32,48 +31,48 @@ class DirectoryUserWithGroups:
|
|
| 32 |
"""The identifier for the Organization in which the Directory resides."""
|
| 33 |
idp_id: str
|
| 34 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 35 |
-
email:
|
| 36 |
"""The email address of the user."""
|
| 37 |
-
state:
|
| 38 |
"""The state of the user."""
|
| 39 |
-
custom_attributes:
|
| 40 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 41 |
created_at: datetime
|
| 42 |
"""An ISO 8601 timestamp."""
|
| 43 |
updated_at: datetime
|
| 44 |
"""An ISO 8601 timestamp."""
|
| 45 |
-
first_name:
|
| 46 |
"""The first name of the user."""
|
| 47 |
-
last_name:
|
| 48 |
"""The last name of the user."""
|
| 49 |
-
name:
|
| 50 |
"""The full name of the user."""
|
| 51 |
-
emails:
|
| 52 |
"""A list of email addresses for the user.
|
| 53 |
|
| 54 |
.. deprecated:: This field is deprecated."""
|
| 55 |
-
job_title:
|
| 56 |
"""The job title of the user.
|
| 57 |
|
| 58 |
.. deprecated:: This field is deprecated."""
|
| 59 |
-
username:
|
| 60 |
"""The username of the user.
|
| 61 |
|
| 62 |
.. deprecated:: This field is deprecated."""
|
| 63 |
-
raw_attributes:
|
| 64 |
"""The raw attributes received from the directory provider.
|
| 65 |
|
| 66 |
.. deprecated:: This field is deprecated."""
|
| 67 |
-
role:
|
| 68 |
-
roles:
|
| 69 |
"""All roles assigned to the user."""
|
| 70 |
-
groups:
|
| 71 |
"""The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance โ the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships.
|
| 72 |
|
| 73 |
.. deprecated:: This field is deprecated."""
|
| 74 |
|
| 75 |
@classmethod
|
| 76 |
-
def from_dict(cls, data:
|
| 77 |
"""Deserialize from a dictionary."""
|
| 78 |
try:
|
| 79 |
return cls(
|
|
@@ -91,7 +90,7 @@ class DirectoryUserWithGroups:
|
|
| 91 |
last_name=data.get("last_name"),
|
| 92 |
name=data.get("name"),
|
| 93 |
emails=[
|
| 94 |
-
DirectoryUserWithGroupsEmail.from_dict(cast(
|
| 95 |
for item in cast(list[Any], _v_emails)
|
| 96 |
]
|
| 97 |
if (_v_emails := data.get("emails")) is not None
|
|
@@ -99,17 +98,17 @@ class DirectoryUserWithGroups:
|
|
| 99 |
job_title=data.get("job_title"),
|
| 100 |
username=data.get("username"),
|
| 101 |
raw_attributes=data.get("raw_attributes"),
|
| 102 |
-
role=SlimRole.from_dict(cast(
|
| 103 |
if (_v_role := data.get("role")) is not None
|
| 104 |
else None,
|
| 105 |
roles=[
|
| 106 |
-
SlimRole.from_dict(cast(
|
| 107 |
for item in cast(list[Any], _v_roles)
|
| 108 |
]
|
| 109 |
if (_v_roles := data.get("roles")) is not None
|
| 110 |
else None,
|
| 111 |
groups=[
|
| 112 |
-
DirectoryGroup.from_dict(cast(
|
| 113 |
for item in cast(list[Any], _v_groups)
|
| 114 |
]
|
| 115 |
if (_v_groups := data.get("groups")) is not None
|
|
@@ -118,9 +117,9 @@ class DirectoryUserWithGroups:
|
|
| 118 |
except (KeyError, ValueError) as e:
|
| 119 |
_raise_deserialize_error("DirectoryUserWithGroups", e)
|
| 120 |
|
| 121 |
-
def to_dict(self) ->
|
| 122 |
"""Serialize to a dictionary."""
|
| 123 |
-
result:
|
| 124 |
result["object"] = self.object
|
| 125 |
result["id"] = self.id
|
| 126 |
result["directory_id"] = self.directory_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.directory_group import DirectoryGroup
|
|
|
|
|
|
|
| 12 |
from workos.common.models.directory_user_with_groups_state import (
|
| 13 |
DirectoryUserWithGroupsState,
|
| 14 |
)
|
| 15 |
+
from workos.common.models.slim_role import SlimRole
|
| 16 |
+
|
| 17 |
+
from .directory_user_with_groups_email import DirectoryUserWithGroupsEmail
|
| 18 |
|
| 19 |
|
| 20 |
@dataclass(slots=True)
|
|
|
|
| 31 |
"""The identifier for the Organization in which the Directory resides."""
|
| 32 |
idp_id: str
|
| 33 |
"""Unique identifier for the user, assigned by the Directory Provider. Different Directory Providers use different ID formats."""
|
| 34 |
+
email: str | None
|
| 35 |
"""The email address of the user."""
|
| 36 |
+
state: DirectoryUserWithGroupsState
|
| 37 |
"""The state of the user."""
|
| 38 |
+
custom_attributes: dict[str, Any]
|
| 39 |
"""An object containing the custom attribute mapping for the Directory Provider."""
|
| 40 |
created_at: datetime
|
| 41 |
"""An ISO 8601 timestamp."""
|
| 42 |
updated_at: datetime
|
| 43 |
"""An ISO 8601 timestamp."""
|
| 44 |
+
first_name: str | None = None
|
| 45 |
"""The first name of the user."""
|
| 46 |
+
last_name: str | None = None
|
| 47 |
"""The last name of the user."""
|
| 48 |
+
name: str | None = None
|
| 49 |
"""The full name of the user."""
|
| 50 |
+
emails: list[DirectoryUserWithGroupsEmail] | None = None
|
| 51 |
"""A list of email addresses for the user.
|
| 52 |
|
| 53 |
.. deprecated:: This field is deprecated."""
|
| 54 |
+
job_title: str | None = None
|
| 55 |
"""The job title of the user.
|
| 56 |
|
| 57 |
.. deprecated:: This field is deprecated."""
|
| 58 |
+
username: str | None = None
|
| 59 |
"""The username of the user.
|
| 60 |
|
| 61 |
.. deprecated:: This field is deprecated."""
|
| 62 |
+
raw_attributes: dict[str, Any] | None = None
|
| 63 |
"""The raw attributes received from the directory provider.
|
| 64 |
|
| 65 |
.. deprecated:: This field is deprecated."""
|
| 66 |
+
role: SlimRole | None = None
|
| 67 |
+
roles: list[SlimRole] | None = None
|
| 68 |
"""All roles assigned to the user."""
|
| 69 |
+
groups: list[DirectoryGroup] | None = None
|
| 70 |
"""The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance โ the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships.
|
| 71 |
|
| 72 |
.. deprecated:: This field is deprecated."""
|
| 73 |
|
| 74 |
@classmethod
|
| 75 |
+
def from_dict(cls, data: dict[str, Any]) -> DirectoryUserWithGroups:
|
| 76 |
"""Deserialize from a dictionary."""
|
| 77 |
try:
|
| 78 |
return cls(
|
|
|
|
| 90 |
last_name=data.get("last_name"),
|
| 91 |
name=data.get("name"),
|
| 92 |
emails=[
|
| 93 |
+
DirectoryUserWithGroupsEmail.from_dict(cast(dict[str, Any], item))
|
| 94 |
for item in cast(list[Any], _v_emails)
|
| 95 |
]
|
| 96 |
if (_v_emails := data.get("emails")) is not None
|
|
|
|
| 98 |
job_title=data.get("job_title"),
|
| 99 |
username=data.get("username"),
|
| 100 |
raw_attributes=data.get("raw_attributes"),
|
| 101 |
+
role=SlimRole.from_dict(cast(dict[str, Any], _v_role))
|
| 102 |
if (_v_role := data.get("role")) is not None
|
| 103 |
else None,
|
| 104 |
roles=[
|
| 105 |
+
SlimRole.from_dict(cast(dict[str, Any], item))
|
| 106 |
for item in cast(list[Any], _v_roles)
|
| 107 |
]
|
| 108 |
if (_v_roles := data.get("roles")) is not None
|
| 109 |
else None,
|
| 110 |
groups=[
|
| 111 |
+
DirectoryGroup.from_dict(cast(dict[str, Any], item))
|
| 112 |
for item in cast(list[Any], _v_groups)
|
| 113 |
]
|
| 114 |
if (_v_groups := data.get("groups")) is not None
|
|
|
|
| 117 |
except (KeyError, ValueError) as e:
|
| 118 |
_raise_deserialize_error("DirectoryUserWithGroups", e)
|
| 119 |
|
| 120 |
+
def to_dict(self) -> dict[str, Any]:
|
| 121 |
"""Serialize to a dictionary."""
|
| 122 |
+
result: dict[str, Any] = {}
|
| 123 |
result["object"] = self.object
|
| 124 |
result["id"] = self.id
|
| 125 |
result["directory_id"] = self.directory_id
|
python/src/workos/events/_resource.py|
@@ -2,35 +2,36 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING,
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
-
from .models import EventSchema, EventSchemaVariant
|
| 12 |
from workos.common.models.pagination_order import PaginationOrder
|
|
|
|
| 13 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class Events:
|
| 17 |
"""Events API resources."""
|
| 18 |
|
| 19 |
-
def __init__(self, client:
|
| 20 |
self._client = client
|
| 21 |
|
| 22 |
def list_events(
|
| 23 |
self,
|
| 24 |
*,
|
| 25 |
-
limit:
|
| 26 |
-
before:
|
| 27 |
-
after:
|
| 28 |
-
order:
|
| 29 |
-
events:
|
| 30 |
-
range_start:
|
| 31 |
-
range_end:
|
| 32 |
-
organization_id:
|
| 33 |
-
request_options:
|
| 34 |
) -> SyncPage[EventSchemaVariant]:
|
| 35 |
"""List events
|
| 36 |
|
|
@@ -88,21 +89,21 @@ class Events:
|
|
| 88 |
class AsyncEvents:
|
| 89 |
"""Events API resources (async)."""
|
| 90 |
|
| 91 |
-
def __init__(self, client:
|
| 92 |
self._client = client
|
| 93 |
|
| 94 |
async def list_events(
|
| 95 |
self,
|
| 96 |
*,
|
| 97 |
-
limit:
|
| 98 |
-
before:
|
| 99 |
-
after:
|
| 100 |
-
order:
|
| 101 |
-
events:
|
| 102 |
-
range_start:
|
| 103 |
-
range_end:
|
| 104 |
-
organization_id:
|
| 105 |
-
request_options:
|
| 106 |
) -> AsyncPage[EventSchemaVariant]:
|
| 107 |
"""List events
|
| 108 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, cast
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
| 10 |
from workos.common.models.pagination_order import PaginationOrder
|
| 11 |
+
|
| 12 |
from .._pagination import AsyncPage, SyncPage
|
| 13 |
+
from .._types import RequestOptions, enum_value
|
| 14 |
+
from .models import EventSchema, EventSchemaVariant
|
| 15 |
|
| 16 |
|
| 17 |
class Events:
|
| 18 |
"""Events API resources."""
|
| 19 |
|
| 20 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 21 |
self._client = client
|
| 22 |
|
| 23 |
def list_events(
|
| 24 |
self,
|
| 25 |
*,
|
| 26 |
+
limit: int | None = None,
|
| 27 |
+
before: str | None = None,
|
| 28 |
+
after: str | None = None,
|
| 29 |
+
order: PaginationOrder | str | None = "desc",
|
| 30 |
+
events: list[str] | None = None,
|
| 31 |
+
range_start: str | None = None,
|
| 32 |
+
range_end: str | None = None,
|
| 33 |
+
organization_id: str | None = None,
|
| 34 |
+
request_options: RequestOptions | None = None,
|
| 35 |
) -> SyncPage[EventSchemaVariant]:
|
| 36 |
"""List events
|
| 37 |
|
|
|
|
| 89 |
class AsyncEvents:
|
| 90 |
"""Events API resources (async)."""
|
| 91 |
|
| 92 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 93 |
self._client = client
|
| 94 |
|
| 95 |
async def list_events(
|
| 96 |
self,
|
| 97 |
*,
|
| 98 |
+
limit: int | None = None,
|
| 99 |
+
before: str | None = None,
|
| 100 |
+
after: str | None = None,
|
| 101 |
+
order: PaginationOrder | str | None = "desc",
|
| 102 |
+
events: list[str] | None = None,
|
| 103 |
+
range_start: str | None = None,
|
| 104 |
+
range_end: str | None = None,
|
| 105 |
+
organization_id: str | None = None,
|
| 106 |
+
request_options: RequestOptions | None = None,
|
| 107 |
) -> AsyncPage[EventSchemaVariant]:
|
| 108 |
"""List events
|
| 109 |
|
python/src/workos/events/models/event_list_list_metadata.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class EventListListMetadata:
|
| 12 |
"""Pagination cursor for navigating to the next page of results."""
|
| 13 |
|
| 14 |
-
after:
|
| 15 |
"""An object ID that defines your place in the list. When the ID is not present, you are at the end of the list."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,9 +25,9 @@ class EventListListMetadata:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("EventListListMetadata", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
if self.after is not None:
|
| 31 |
result["after"] = self.after
|
| 32 |
else:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class EventListListMetadata:
|
| 13 |
"""Pagination cursor for navigating to the next page of results."""
|
| 14 |
|
| 15 |
+
after: str | None
|
| 16 |
"""An object ID that defines your place in the list. When the ID is not present, you are at the end of the list."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> EventListListMetadata:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("EventListListMetadata", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
if self.after is not None:
|
| 32 |
result["after"] = self.after
|
| 33 |
else:
|
python/src/workos/events/models/event_schema.py|
@@ -3,9 +3,9 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any, ClassVar,
|
| 7 |
-
from workos._types import _raise_deserialize_error
|
| 8 |
|
|
|
|
| 9 |
from workos.common.models.action_authentication_denied import ActionAuthenticationDenied
|
| 10 |
from workos.common.models.action_user_registration_denied import (
|
| 11 |
ActionUserRegistrationDenied,
|
|
@@ -25,6 +25,7 @@ from workos.common.models.agent_registration_expired import AgentRegistrationExp
|
|
| 25 |
from workos.common.models.agent_registration_organization_switched import (
|
| 26 |
AgentRegistrationOrganizationSwitched,
|
| 27 |
)
|
|
|
|
| 28 |
from workos.common.models.agent_registration_revoked import AgentRegistrationRevoked
|
| 29 |
from workos.common.models.api_key_created import ApiKeyCreated
|
| 30 |
from workos.common.models.api_key_revoked import ApiKeyRevoked
|
|
@@ -176,15 +177,15 @@ from workos.common.models.waitlist_user_denied import WaitlistUserDenied
|
|
| 176 |
class EventSchemaUnknown:
|
| 177 |
"""Unknown variant of EventSchema not yet recognized by this SDK version."""
|
| 178 |
|
| 179 |
-
raw_data:
|
| 180 |
"""The raw payload, preserved so callers can still inspect the data."""
|
| 181 |
|
| 182 |
@classmethod
|
| 183 |
-
def from_dict(cls, data:
|
| 184 |
"""Wrap raw data in an unknown variant."""
|
| 185 |
return cls(raw_data=data)
|
| 186 |
|
| 187 |
-
def to_dict(self) ->
|
| 188 |
"""Return the original raw data."""
|
| 189 |
return dict(self.raw_data)
|
| 190 |
|
|
@@ -199,6 +200,7 @@ EventSchemaVariant = Union[
|
|
| 199 |
AgentRegistrationDeleted,
|
| 200 |
AgentRegistrationExpired,
|
| 201 |
AgentRegistrationOrganizationSwitched,
|
|
|
|
| 202 |
AgentRegistrationRevoked,
|
| 203 |
ApiKeyCreated,
|
| 204 |
ApiKeyRevoked,
|
|
@@ -307,7 +309,7 @@ EventSchemaVariant = Union[
|
|
| 307 |
class EventSchema:
|
| 308 |
"""An event emitted by WorkOS."""
|
| 309 |
|
| 310 |
-
_DISPATCH: ClassVar[
|
| 311 |
"action.authentication.denied": ActionAuthenticationDenied,
|
| 312 |
"action.user_registration.denied": ActionUserRegistrationDenied,
|
| 313 |
"agent.registration.claim.attempt.created": AgentRegistrationClaimAttemptCreated,
|
|
@@ -317,6 +319,7 @@ class EventSchema:
|
|
| 317 |
"agent.registration.deleted": AgentRegistrationDeleted,
|
| 318 |
"agent.registration.expired": AgentRegistrationExpired,
|
| 319 |
"agent.registration.organization.switched": AgentRegistrationOrganizationSwitched,
|
|
|
|
| 320 |
"agent.registration.revoked": AgentRegistrationRevoked,
|
| 321 |
"api_key.created": ApiKeyCreated,
|
| 322 |
"api_key.revoked": ApiKeyRevoked,
|
|
@@ -421,7 +424,7 @@ class EventSchema:
|
|
| 421 |
}
|
| 422 |
|
| 423 |
@classmethod
|
| 424 |
-
def from_dict(cls, data:
|
| 425 |
"""Deserialize from a dictionary, dispatching to the correct variant."""
|
| 426 |
if "event" not in data:
|
| 427 |
_raise_deserialize_error(
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, ClassVar, Union, cast
|
|
|
|
| 7 |
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.action_authentication_denied import ActionAuthenticationDenied
|
| 10 |
from workos.common.models.action_user_registration_denied import (
|
| 11 |
ActionUserRegistrationDenied,
|
|
|
|
| 25 |
from workos.common.models.agent_registration_organization_switched import (
|
| 26 |
AgentRegistrationOrganizationSwitched,
|
| 27 |
)
|
| 28 |
+
from workos.common.models.agent_registration_refreshed import AgentRegistrationRefreshed
|
| 29 |
from workos.common.models.agent_registration_revoked import AgentRegistrationRevoked
|
| 30 |
from workos.common.models.api_key_created import ApiKeyCreated
|
| 31 |
from workos.common.models.api_key_revoked import ApiKeyRevoked
|
|
|
|
| 177 |
class EventSchemaUnknown:
|
| 178 |
"""Unknown variant of EventSchema not yet recognized by this SDK version."""
|
| 179 |
|
| 180 |
+
raw_data: dict[str, Any]
|
| 181 |
"""The raw payload, preserved so callers can still inspect the data."""
|
| 182 |
|
| 183 |
@classmethod
|
| 184 |
+
def from_dict(cls, data: dict[str, Any]) -> EventSchemaUnknown:
|
| 185 |
"""Wrap raw data in an unknown variant."""
|
| 186 |
return cls(raw_data=data)
|
| 187 |
|
| 188 |
+
def to_dict(self) -> dict[str, Any]:
|
| 189 |
"""Return the original raw data."""
|
| 190 |
return dict(self.raw_data)
|
| 191 |
|
|
|
|
| 200 |
AgentRegistrationDeleted,
|
| 201 |
AgentRegistrationExpired,
|
| 202 |
AgentRegistrationOrganizationSwitched,
|
| 203 |
+
AgentRegistrationRefreshed,
|
| 204 |
AgentRegistrationRevoked,
|
| 205 |
ApiKeyCreated,
|
| 206 |
ApiKeyRevoked,
|
|
|
|
| 309 |
class EventSchema:
|
| 310 |
"""An event emitted by WorkOS."""
|
| 311 |
|
| 312 |
+
_DISPATCH: ClassVar[dict[str, type]] = {
|
| 313 |
"action.authentication.denied": ActionAuthenticationDenied,
|
| 314 |
"action.user_registration.denied": ActionUserRegistrationDenied,
|
| 315 |
"agent.registration.claim.attempt.created": AgentRegistrationClaimAttemptCreated,
|
|
|
|
| 319 |
"agent.registration.deleted": AgentRegistrationDeleted,
|
| 320 |
"agent.registration.expired": AgentRegistrationExpired,
|
| 321 |
"agent.registration.organization.switched": AgentRegistrationOrganizationSwitched,
|
| 322 |
+
"agent.registration.refreshed": AgentRegistrationRefreshed,
|
| 323 |
"agent.registration.revoked": AgentRegistrationRevoked,
|
| 324 |
"api_key.created": ApiKeyCreated,
|
| 325 |
"api_key.revoked": ApiKeyRevoked,
|
|
|
|
| 424 |
}
|
| 425 |
|
| 426 |
@classmethod
|
| 427 |
+
def from_dict(cls, data: dict[str, Any]) -> EventSchemaVariant:
|
| 428 |
"""Deserialize from a dictionary, dispatching to the correct variant."""
|
| 429 |
if "event" not in data:
|
| 430 |
_raise_deserialize_error(
|
python/src/workos/feature_flags/_resource.py|
@@ -2,32 +2,33 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
from workos.common.models.feature_flag import FeatureFlag
|
| 12 |
from workos.common.models.flag import Flag
|
| 13 |
from workos.common.models.pagination_order import PaginationOrder
|
|
|
|
| 14 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
class FeatureFlags:
|
| 18 |
"""Feature Flags API resources."""
|
| 19 |
|
| 20 |
-
def __init__(self, client:
|
| 21 |
self._client = client
|
| 22 |
|
| 23 |
def list_feature_flags(
|
| 24 |
self,
|
| 25 |
*,
|
| 26 |
-
limit:
|
| 27 |
-
before:
|
| 28 |
-
after:
|
| 29 |
-
order:
|
| 30 |
-
request_options:
|
| 31 |
) -> SyncPage[Flag]:
|
| 32 |
"""List feature flags
|
| 33 |
|
|
@@ -73,7 +74,7 @@ class FeatureFlags:
|
|
| 73 |
self,
|
| 74 |
slug: str,
|
| 75 |
*,
|
| 76 |
-
request_options:
|
| 77 |
) -> Flag:
|
| 78 |
"""Get a feature flag
|
| 79 |
|
|
@@ -103,7 +104,7 @@ class FeatureFlags:
|
|
| 103 |
self,
|
| 104 |
slug: str,
|
| 105 |
*,
|
| 106 |
-
request_options:
|
| 107 |
) -> FeatureFlag:
|
| 108 |
"""Disable a feature flag
|
| 109 |
|
|
@@ -133,7 +134,7 @@ class FeatureFlags:
|
|
| 133 |
self,
|
| 134 |
slug: str,
|
| 135 |
*,
|
| 136 |
-
request_options:
|
| 137 |
) -> FeatureFlag:
|
| 138 |
"""Enable a feature flag
|
| 139 |
|
|
@@ -164,7 +165,7 @@ class FeatureFlags:
|
|
| 164 |
resource_id: str,
|
| 165 |
slug: str,
|
| 166 |
*,
|
| 167 |
-
request_options:
|
| 168 |
) -> None:
|
| 169 |
"""Add a feature flag target
|
| 170 |
|
|
@@ -194,7 +195,7 @@ class FeatureFlags:
|
|
| 194 |
resource_id: str,
|
| 195 |
slug: str,
|
| 196 |
*,
|
| 197 |
-
request_options:
|
| 198 |
) -> None:
|
| 199 |
"""Remove a feature flag target
|
| 200 |
|
|
@@ -223,11 +224,11 @@ class FeatureFlags:
|
|
| 223 |
self,
|
| 224 |
organization_id: str,
|
| 225 |
*,
|
| 226 |
-
limit:
|
| 227 |
-
before:
|
| 228 |
-
after:
|
| 229 |
-
order:
|
| 230 |
-
request_options:
|
| 231 |
) -> SyncPage[Flag]:
|
| 232 |
"""List enabled feature flags for an organization
|
| 233 |
|
|
@@ -272,11 +273,11 @@ class FeatureFlags:
|
|
| 272 |
self,
|
| 273 |
user_id: str,
|
| 274 |
*,
|
| 275 |
-
limit:
|
| 276 |
-
before:
|
| 277 |
-
after:
|
| 278 |
-
order:
|
| 279 |
-
request_options:
|
| 280 |
) -> SyncPage[Flag]:
|
| 281 |
"""List enabled feature flags for a user
|
| 282 |
|
|
@@ -321,17 +322,17 @@ class FeatureFlags:
|
|
| 321 |
class AsyncFeatureFlags:
|
| 322 |
"""Feature Flags API resources (async)."""
|
| 323 |
|
| 324 |
-
def __init__(self, client:
|
| 325 |
self._client = client
|
| 326 |
|
| 327 |
async def list_feature_flags(
|
| 328 |
self,
|
| 329 |
*,
|
| 330 |
-
limit:
|
| 331 |
-
before:
|
| 332 |
-
after:
|
| 333 |
-
order:
|
| 334 |
-
request_options:
|
| 335 |
) -> AsyncPage[Flag]:
|
| 336 |
"""List feature flags
|
| 337 |
|
|
@@ -377,7 +378,7 @@ class AsyncFeatureFlags:
|
|
| 377 |
self,
|
| 378 |
slug: str,
|
| 379 |
*,
|
| 380 |
-
request_options:
|
| 381 |
) -> Flag:
|
| 382 |
"""Get a feature flag
|
| 383 |
|
|
@@ -407,7 +408,7 @@ class AsyncFeatureFlags:
|
|
| 407 |
self,
|
| 408 |
slug: str,
|
| 409 |
*,
|
| 410 |
-
request_options:
|
| 411 |
) -> FeatureFlag:
|
| 412 |
"""Disable a feature flag
|
| 413 |
|
|
@@ -437,7 +438,7 @@ class AsyncFeatureFlags:
|
|
| 437 |
self,
|
| 438 |
slug: str,
|
| 439 |
*,
|
| 440 |
-
request_options:
|
| 441 |
) -> FeatureFlag:
|
| 442 |
"""Enable a feature flag
|
| 443 |
|
|
@@ -468,7 +469,7 @@ class AsyncFeatureFlags:
|
|
| 468 |
resource_id: str,
|
| 469 |
slug: str,
|
| 470 |
*,
|
| 471 |
-
request_options:
|
| 472 |
) -> None:
|
| 473 |
"""Add a feature flag target
|
| 474 |
|
|
@@ -498,7 +499,7 @@ class AsyncFeatureFlags:
|
|
| 498 |
resource_id: str,
|
| 499 |
slug: str,
|
| 500 |
*,
|
| 501 |
-
request_options:
|
| 502 |
) -> None:
|
| 503 |
"""Remove a feature flag target
|
| 504 |
|
|
@@ -527,11 +528,11 @@ class AsyncFeatureFlags:
|
|
| 527 |
self,
|
| 528 |
organization_id: str,
|
| 529 |
*,
|
| 530 |
-
limit:
|
| 531 |
-
before:
|
| 532 |
-
after:
|
| 533 |
-
order:
|
| 534 |
-
request_options:
|
| 535 |
) -> AsyncPage[Flag]:
|
| 536 |
"""List enabled feature flags for an organization
|
| 537 |
|
|
@@ -576,11 +577,11 @@ class AsyncFeatureFlags:
|
|
| 576 |
self,
|
| 577 |
user_id: str,
|
| 578 |
*,
|
| 579 |
-
limit:
|
| 580 |
-
before:
|
| 581 |
-
after:
|
| 582 |
-
order:
|
| 583 |
-
request_options:
|
| 584 |
) -> AsyncPage[Flag]:
|
| 585 |
"""List enabled feature flags for a user
|
| 586 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.feature_flag import FeatureFlag
|
| 11 |
from workos.common.models.flag import Flag
|
| 12 |
from workos.common.models.pagination_order import PaginationOrder
|
| 13 |
+
|
| 14 |
from .._pagination import AsyncPage, SyncPage
|
| 15 |
+
from .._types import RequestOptions, enum_value
|
| 16 |
|
| 17 |
|
| 18 |
class FeatureFlags:
|
| 19 |
"""Feature Flags API resources."""
|
| 20 |
|
| 21 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 22 |
self._client = client
|
| 23 |
|
| 24 |
def list_feature_flags(
|
| 25 |
self,
|
| 26 |
*,
|
| 27 |
+
limit: int | None = None,
|
| 28 |
+
before: str | None = None,
|
| 29 |
+
after: str | None = None,
|
| 30 |
+
order: PaginationOrder | str | None = "desc",
|
| 31 |
+
request_options: RequestOptions | None = None,
|
| 32 |
) -> SyncPage[Flag]:
|
| 33 |
"""List feature flags
|
| 34 |
|
|
|
|
| 74 |
self,
|
| 75 |
slug: str,
|
| 76 |
*,
|
| 77 |
+
request_options: RequestOptions | None = None,
|
| 78 |
) -> Flag:
|
| 79 |
"""Get a feature flag
|
| 80 |
|
|
|
|
| 104 |
self,
|
| 105 |
slug: str,
|
| 106 |
*,
|
| 107 |
+
request_options: RequestOptions | None = None,
|
| 108 |
) -> FeatureFlag:
|
| 109 |
"""Disable a feature flag
|
| 110 |
|
|
|
|
| 134 |
self,
|
| 135 |
slug: str,
|
| 136 |
*,
|
| 137 |
+
request_options: RequestOptions | None = None,
|
| 138 |
) -> FeatureFlag:
|
| 139 |
"""Enable a feature flag
|
| 140 |
|
|
|
|
| 165 |
resource_id: str,
|
| 166 |
slug: str,
|
| 167 |
*,
|
| 168 |
+
request_options: RequestOptions | None = None,
|
| 169 |
) -> None:
|
| 170 |
"""Add a feature flag target
|
| 171 |
|
|
|
|
| 195 |
resource_id: str,
|
| 196 |
slug: str,
|
| 197 |
*,
|
| 198 |
+
request_options: RequestOptions | None = None,
|
| 199 |
) -> None:
|
| 200 |
"""Remove a feature flag target
|
| 201 |
|
|
|
|
| 224 |
self,
|
| 225 |
organization_id: str,
|
| 226 |
*,
|
| 227 |
+
limit: int | None = None,
|
| 228 |
+
before: str | None = None,
|
| 229 |
+
after: str | None = None,
|
| 230 |
+
order: PaginationOrder | str | None = "desc",
|
| 231 |
+
request_options: RequestOptions | None = None,
|
| 232 |
) -> SyncPage[Flag]:
|
| 233 |
"""List enabled feature flags for an organization
|
| 234 |
|
|
|
|
| 273 |
self,
|
| 274 |
user_id: str,
|
| 275 |
*,
|
| 276 |
+
limit: int | None = None,
|
| 277 |
+
before: str | None = None,
|
| 278 |
+
after: str | None = None,
|
| 279 |
+
order: PaginationOrder | str | None = "desc",
|
| 280 |
+
request_options: RequestOptions | None = None,
|
| 281 |
) -> SyncPage[Flag]:
|
| 282 |
"""List enabled feature flags for a user
|
| 283 |
|
|
|
|
| 322 |
class AsyncFeatureFlags:
|
| 323 |
"""Feature Flags API resources (async)."""
|
| 324 |
|
| 325 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 326 |
self._client = client
|
| 327 |
|
| 328 |
async def list_feature_flags(
|
| 329 |
self,
|
| 330 |
*,
|
| 331 |
+
limit: int | None = None,
|
| 332 |
+
before: str | None = None,
|
| 333 |
+
after: str | None = None,
|
| 334 |
+
order: PaginationOrder | str | None = "desc",
|
| 335 |
+
request_options: RequestOptions | None = None,
|
| 336 |
) -> AsyncPage[Flag]:
|
| 337 |
"""List feature flags
|
| 338 |
|
|
|
|
| 378 |
self,
|
| 379 |
slug: str,
|
| 380 |
*,
|
| 381 |
+
request_options: RequestOptions | None = None,
|
| 382 |
) -> Flag:
|
| 383 |
"""Get a feature flag
|
| 384 |
|
|
|
|
| 408 |
self,
|
| 409 |
slug: str,
|
| 410 |
*,
|
| 411 |
+
request_options: RequestOptions | None = None,
|
| 412 |
) -> FeatureFlag:
|
| 413 |
"""Disable a feature flag
|
| 414 |
|
|
|
|
| 438 |
self,
|
| 439 |
slug: str,
|
| 440 |
*,
|
| 441 |
+
request_options: RequestOptions | None = None,
|
| 442 |
) -> FeatureFlag:
|
| 443 |
"""Enable a feature flag
|
| 444 |
|
|
|
|
| 469 |
resource_id: str,
|
| 470 |
slug: str,
|
| 471 |
*,
|
| 472 |
+
request_options: RequestOptions | None = None,
|
| 473 |
) -> None:
|
| 474 |
"""Add a feature flag target
|
| 475 |
|
|
|
|
| 499 |
resource_id: str,
|
| 500 |
slug: str,
|
| 501 |
*,
|
| 502 |
+
request_options: RequestOptions | None = None,
|
| 503 |
) -> None:
|
| 504 |
"""Remove a feature flag target
|
| 505 |
|
|
|
|
| 528 |
self,
|
| 529 |
organization_id: str,
|
| 530 |
*,
|
| 531 |
+
limit: int | None = None,
|
| 532 |
+
before: str | None = None,
|
| 533 |
+
after: str | None = None,
|
| 534 |
+
order: PaginationOrder | str | None = "desc",
|
| 535 |
+
request_options: RequestOptions | None = None,
|
| 536 |
) -> AsyncPage[Flag]:
|
| 537 |
"""List enabled feature flags for an organization
|
| 538 |
|
|
|
|
| 577 |
self,
|
| 578 |
user_id: str,
|
| 579 |
*,
|
| 580 |
+
limit: int | None = None,
|
| 581 |
+
before: str | None = None,
|
| 582 |
+
after: str | None = None,
|
| 583 |
+
order: PaginationOrder | str | None = "desc",
|
| 584 |
+
request_options: RequestOptions | None = None,
|
| 585 |
) -> AsyncPage[Flag]:
|
| 586 |
"""List enabled feature flags for a user
|
| 587 |
|
python/src/workos/groups/_resource.py|
@@ -2,35 +2,36 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value, NOT_GIVEN, NotGiven
|
| 11 |
from workos.common.models.group import Group
|
|
|
|
| 12 |
from workos.common.models.user_organization_membership_base_list_data import (
|
| 13 |
UserOrganizationMembershipBaseListData,
|
| 14 |
)
|
| 15 |
-
|
| 16 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
class Groups:
|
| 20 |
"""Groups API resources."""
|
| 21 |
|
| 22 |
-
def __init__(self, client:
|
| 23 |
self._client = client
|
| 24 |
|
| 25 |
def list_organization_groups(
|
| 26 |
self,
|
| 27 |
organization_id: str,
|
| 28 |
*,
|
| 29 |
-
limit:
|
| 30 |
-
before:
|
| 31 |
-
after:
|
| 32 |
-
order:
|
| 33 |
-
request_options:
|
| 34 |
) -> SyncPage[Group]:
|
| 35 |
"""List groups
|
| 36 |
|
|
@@ -77,8 +78,8 @@ class Groups:
|
|
| 77 |
organization_id: str,
|
| 78 |
*,
|
| 79 |
name: str,
|
| 80 |
-
description:
|
| 81 |
-
request_options:
|
| 82 |
) -> Group:
|
| 83 |
"""Create a group
|
| 84 |
|
|
@@ -102,7 +103,7 @@ class Groups:
|
|
| 102 |
RateLimitExceededError: If rate limited (429).
|
| 103 |
ServerError: If the server returns a 5xx error.
|
| 104 |
"""
|
| 105 |
-
body:
|
| 106 |
"name": name,
|
| 107 |
}
|
| 108 |
if not isinstance(description, NotGiven):
|
|
@@ -120,7 +121,7 @@ class Groups:
|
|
| 120 |
organization_id: str,
|
| 121 |
group_id: str,
|
| 122 |
*,
|
| 123 |
-
request_options:
|
| 124 |
) -> Group:
|
| 125 |
"""Get a group
|
| 126 |
|
|
@@ -153,9 +154,9 @@ class Groups:
|
|
| 153 |
organization_id: str,
|
| 154 |
group_id: str,
|
| 155 |
*,
|
| 156 |
-
name:
|
| 157 |
-
description:
|
| 158 |
-
request_options:
|
| 159 |
) -> Group:
|
| 160 |
"""Update a group
|
| 161 |
|
|
@@ -180,7 +181,7 @@ class Groups:
|
|
| 180 |
RateLimitExceededError: If rate limited (429).
|
| 181 |
ServerError: If the server returns a 5xx error.
|
| 182 |
"""
|
| 183 |
-
body:
|
| 184 |
k: v
|
| 185 |
for k, v in {
|
| 186 |
"name": name,
|
|
@@ -202,7 +203,7 @@ class Groups:
|
|
| 202 |
organization_id: str,
|
| 203 |
group_id: str,
|
| 204 |
*,
|
| 205 |
-
request_options:
|
| 206 |
) -> None:
|
| 207 |
"""Delete a group
|
| 208 |
|
|
@@ -231,11 +232,11 @@ class Groups:
|
|
| 231 |
organization_id: str,
|
| 232 |
group_id: str,
|
| 233 |
*,
|
| 234 |
-
limit:
|
| 235 |
-
before:
|
| 236 |
-
after:
|
| 237 |
-
order:
|
| 238 |
-
request_options:
|
| 239 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 240 |
"""List Group members
|
| 241 |
|
|
@@ -290,7 +291,7 @@ class Groups:
|
|
| 290 |
group_id: str,
|
| 291 |
*,
|
| 292 |
organization_membership_id: str,
|
| 293 |
-
request_options:
|
| 294 |
) -> Group:
|
| 295 |
"""Add a member to a Group
|
| 296 |
|
|
@@ -314,7 +315,7 @@ class Groups:
|
|
| 314 |
RateLimitExceededError: If rate limited (429).
|
| 315 |
ServerError: If the server returns a 5xx error.
|
| 316 |
"""
|
| 317 |
-
body:
|
| 318 |
"organization_membership_id": organization_membership_id,
|
| 319 |
}
|
| 320 |
return self._client.request(
|
|
@@ -337,7 +338,7 @@ class Groups:
|
|
| 337 |
group_id: str,
|
| 338 |
om_id: str,
|
| 339 |
*,
|
| 340 |
-
request_options:
|
| 341 |
) -> None:
|
| 342 |
"""Remove a member from a Group
|
| 343 |
|
|
@@ -373,18 +374,18 @@ class Groups:
|
|
| 373 |
class AsyncGroups:
|
| 374 |
"""Groups API resources (async)."""
|
| 375 |
|
| 376 |
-
def __init__(self, client:
|
| 377 |
self._client = client
|
| 378 |
|
| 379 |
async def list_organization_groups(
|
| 380 |
self,
|
| 381 |
organization_id: str,
|
| 382 |
*,
|
| 383 |
-
limit:
|
| 384 |
-
before:
|
| 385 |
-
after:
|
| 386 |
-
order:
|
| 387 |
-
request_options:
|
| 388 |
) -> AsyncPage[Group]:
|
| 389 |
"""List groups
|
| 390 |
|
|
@@ -431,8 +432,8 @@ class AsyncGroups:
|
|
| 431 |
organization_id: str,
|
| 432 |
*,
|
| 433 |
name: str,
|
| 434 |
-
description:
|
| 435 |
-
request_options:
|
| 436 |
) -> Group:
|
| 437 |
"""Create a group
|
| 438 |
|
|
@@ -456,7 +457,7 @@ class AsyncGroups:
|
|
| 456 |
RateLimitExceededError: If rate limited (429).
|
| 457 |
ServerError: If the server returns a 5xx error.
|
| 458 |
"""
|
| 459 |
-
body:
|
| 460 |
"name": name,
|
| 461 |
}
|
| 462 |
if not isinstance(description, NotGiven):
|
|
@@ -474,7 +475,7 @@ class AsyncGroups:
|
|
| 474 |
organization_id: str,
|
| 475 |
group_id: str,
|
| 476 |
*,
|
| 477 |
-
request_options:
|
| 478 |
) -> Group:
|
| 479 |
"""Get a group
|
| 480 |
|
|
@@ -507,9 +508,9 @@ class AsyncGroups:
|
|
| 507 |
organization_id: str,
|
| 508 |
group_id: str,
|
| 509 |
*,
|
| 510 |
-
name:
|
| 511 |
-
description:
|
| 512 |
-
request_options:
|
| 513 |
) -> Group:
|
| 514 |
"""Update a group
|
| 515 |
|
|
@@ -534,7 +535,7 @@ class AsyncGroups:
|
|
| 534 |
RateLimitExceededError: If rate limited (429).
|
| 535 |
ServerError: If the server returns a 5xx error.
|
| 536 |
"""
|
| 537 |
-
body:
|
| 538 |
k: v
|
| 539 |
for k, v in {
|
| 540 |
"name": name,
|
|
@@ -556,7 +557,7 @@ class AsyncGroups:
|
|
| 556 |
organization_id: str,
|
| 557 |
group_id: str,
|
| 558 |
*,
|
| 559 |
-
request_options:
|
| 560 |
) -> None:
|
| 561 |
"""Delete a group
|
| 562 |
|
|
@@ -585,11 +586,11 @@ class AsyncGroups:
|
|
| 585 |
organization_id: str,
|
| 586 |
group_id: str,
|
| 587 |
*,
|
| 588 |
-
limit:
|
| 589 |
-
before:
|
| 590 |
-
after:
|
| 591 |
-
order:
|
| 592 |
-
request_options:
|
| 593 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 594 |
"""List Group members
|
| 595 |
|
|
@@ -644,7 +645,7 @@ class AsyncGroups:
|
|
| 644 |
group_id: str,
|
| 645 |
*,
|
| 646 |
organization_membership_id: str,
|
| 647 |
-
request_options:
|
| 648 |
) -> Group:
|
| 649 |
"""Add a member to a Group
|
| 650 |
|
|
@@ -668,7 +669,7 @@ class AsyncGroups:
|
|
| 668 |
RateLimitExceededError: If rate limited (429).
|
| 669 |
ServerError: If the server returns a 5xx error.
|
| 670 |
"""
|
| 671 |
-
body:
|
| 672 |
"organization_membership_id": organization_membership_id,
|
| 673 |
}
|
| 674 |
return await self._client.request(
|
|
@@ -691,7 +692,7 @@ class AsyncGroups:
|
|
| 691 |
group_id: str,
|
| 692 |
om_id: str,
|
| 693 |
*,
|
| 694 |
-
request_options:
|
| 695 |
) -> None:
|
| 696 |
"""Remove a member from a Group
|
| 697 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.group import Group
|
| 11 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 12 |
from workos.common.models.user_organization_membership_base_list_data import (
|
| 13 |
UserOrganizationMembershipBaseListData,
|
| 14 |
)
|
| 15 |
+
|
| 16 |
from .._pagination import AsyncPage, SyncPage
|
| 17 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 18 |
|
| 19 |
|
| 20 |
class Groups:
|
| 21 |
"""Groups API resources."""
|
| 22 |
|
| 23 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 24 |
self._client = client
|
| 25 |
|
| 26 |
def list_organization_groups(
|
| 27 |
self,
|
| 28 |
organization_id: str,
|
| 29 |
*,
|
| 30 |
+
limit: int | None = None,
|
| 31 |
+
before: str | None = None,
|
| 32 |
+
after: str | None = None,
|
| 33 |
+
order: PaginationOrder | str | None = "desc",
|
| 34 |
+
request_options: RequestOptions | None = None,
|
| 35 |
) -> SyncPage[Group]:
|
| 36 |
"""List groups
|
| 37 |
|
|
|
|
| 78 |
organization_id: str,
|
| 79 |
*,
|
| 80 |
name: str,
|
| 81 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 82 |
+
request_options: RequestOptions | None = None,
|
| 83 |
) -> Group:
|
| 84 |
"""Create a group
|
| 85 |
|
|
|
|
| 103 |
RateLimitExceededError: If rate limited (429).
|
| 104 |
ServerError: If the server returns a 5xx error.
|
| 105 |
"""
|
| 106 |
+
body: dict[str, Any] = {
|
| 107 |
"name": name,
|
| 108 |
}
|
| 109 |
if not isinstance(description, NotGiven):
|
|
|
|
| 121 |
organization_id: str,
|
| 122 |
group_id: str,
|
| 123 |
*,
|
| 124 |
+
request_options: RequestOptions | None = None,
|
| 125 |
) -> Group:
|
| 126 |
"""Get a group
|
| 127 |
|
|
|
|
| 154 |
organization_id: str,
|
| 155 |
group_id: str,
|
| 156 |
*,
|
| 157 |
+
name: str | None = None,
|
| 158 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 159 |
+
request_options: RequestOptions | None = None,
|
| 160 |
) -> Group:
|
| 161 |
"""Update a group
|
| 162 |
|
|
|
|
| 181 |
RateLimitExceededError: If rate limited (429).
|
| 182 |
ServerError: If the server returns a 5xx error.
|
| 183 |
"""
|
| 184 |
+
body: dict[str, Any] = {
|
| 185 |
k: v
|
| 186 |
for k, v in {
|
| 187 |
"name": name,
|
|
|
|
| 203 |
organization_id: str,
|
| 204 |
group_id: str,
|
| 205 |
*,
|
| 206 |
+
request_options: RequestOptions | None = None,
|
| 207 |
) -> None:
|
| 208 |
"""Delete a group
|
| 209 |
|
|
|
|
| 232 |
organization_id: str,
|
| 233 |
group_id: str,
|
| 234 |
*,
|
| 235 |
+
limit: int | None = None,
|
| 236 |
+
before: str | None = None,
|
| 237 |
+
after: str | None = None,
|
| 238 |
+
order: PaginationOrder | str | None = "desc",
|
| 239 |
+
request_options: RequestOptions | None = None,
|
| 240 |
) -> SyncPage[UserOrganizationMembershipBaseListData]:
|
| 241 |
"""List Group members
|
| 242 |
|
|
|
|
| 291 |
group_id: str,
|
| 292 |
*,
|
| 293 |
organization_membership_id: str,
|
| 294 |
+
request_options: RequestOptions | None = None,
|
| 295 |
) -> Group:
|
| 296 |
"""Add a member to a Group
|
| 297 |
|
|
|
|
| 315 |
RateLimitExceededError: If rate limited (429).
|
| 316 |
ServerError: If the server returns a 5xx error.
|
| 317 |
"""
|
| 318 |
+
body: dict[str, Any] = {
|
| 319 |
"organization_membership_id": organization_membership_id,
|
| 320 |
}
|
| 321 |
return self._client.request(
|
|
|
|
| 338 |
group_id: str,
|
| 339 |
om_id: str,
|
| 340 |
*,
|
| 341 |
+
request_options: RequestOptions | None = None,
|
| 342 |
) -> None:
|
| 343 |
"""Remove a member from a Group
|
| 344 |
|
|
|
|
| 374 |
class AsyncGroups:
|
| 375 |
"""Groups API resources (async)."""
|
| 376 |
|
| 377 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 378 |
self._client = client
|
| 379 |
|
| 380 |
async def list_organization_groups(
|
| 381 |
self,
|
| 382 |
organization_id: str,
|
| 383 |
*,
|
| 384 |
+
limit: int | None = None,
|
| 385 |
+
before: str | None = None,
|
| 386 |
+
after: str | None = None,
|
| 387 |
+
order: PaginationOrder | str | None = "desc",
|
| 388 |
+
request_options: RequestOptions | None = None,
|
| 389 |
) -> AsyncPage[Group]:
|
| 390 |
"""List groups
|
| 391 |
|
|
|
|
| 432 |
organization_id: str,
|
| 433 |
*,
|
| 434 |
name: str,
|
| 435 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 436 |
+
request_options: RequestOptions | None = None,
|
| 437 |
) -> Group:
|
| 438 |
"""Create a group
|
| 439 |
|
|
|
|
| 457 |
RateLimitExceededError: If rate limited (429).
|
| 458 |
ServerError: If the server returns a 5xx error.
|
| 459 |
"""
|
| 460 |
+
body: dict[str, Any] = {
|
| 461 |
"name": name,
|
| 462 |
}
|
| 463 |
if not isinstance(description, NotGiven):
|
|
|
|
| 475 |
organization_id: str,
|
| 476 |
group_id: str,
|
| 477 |
*,
|
| 478 |
+
request_options: RequestOptions | None = None,
|
| 479 |
) -> Group:
|
| 480 |
"""Get a group
|
| 481 |
|
|
|
|
| 508 |
organization_id: str,
|
| 509 |
group_id: str,
|
| 510 |
*,
|
| 511 |
+
name: str | None = None,
|
| 512 |
+
description: str | None | NotGiven = NOT_GIVEN,
|
| 513 |
+
request_options: RequestOptions | None = None,
|
| 514 |
) -> Group:
|
| 515 |
"""Update a group
|
| 516 |
|
|
|
|
| 535 |
RateLimitExceededError: If rate limited (429).
|
| 536 |
ServerError: If the server returns a 5xx error.
|
| 537 |
"""
|
| 538 |
+
body: dict[str, Any] = {
|
| 539 |
k: v
|
| 540 |
for k, v in {
|
| 541 |
"name": name,
|
|
|
|
| 557 |
organization_id: str,
|
| 558 |
group_id: str,
|
| 559 |
*,
|
| 560 |
+
request_options: RequestOptions | None = None,
|
| 561 |
) -> None:
|
| 562 |
"""Delete a group
|
| 563 |
|
|
|
|
| 586 |
organization_id: str,
|
| 587 |
group_id: str,
|
| 588 |
*,
|
| 589 |
+
limit: int | None = None,
|
| 590 |
+
before: str | None = None,
|
| 591 |
+
after: str | None = None,
|
| 592 |
+
order: PaginationOrder | str | None = "desc",
|
| 593 |
+
request_options: RequestOptions | None = None,
|
| 594 |
) -> AsyncPage[UserOrganizationMembershipBaseListData]:
|
| 595 |
"""List Group members
|
| 596 |
|
|
|
|
| 645 |
group_id: str,
|
| 646 |
*,
|
| 647 |
organization_membership_id: str,
|
| 648 |
+
request_options: RequestOptions | None = None,
|
| 649 |
) -> Group:
|
| 650 |
"""Add a member to a Group
|
| 651 |
|
|
|
|
| 669 |
RateLimitExceededError: If rate limited (429).
|
| 670 |
ServerError: If the server returns a 5xx error.
|
| 671 |
"""
|
| 672 |
+
body: dict[str, Any] = {
|
| 673 |
"organization_membership_id": organization_membership_id,
|
| 674 |
}
|
| 675 |
return await self._client.request(
|
|
|
|
| 692 |
group_id: str,
|
| 693 |
om_id: str,
|
| 694 |
*,
|
| 695 |
+
request_options: RequestOptions | None = None,
|
| 696 |
) -> None:
|
| 697 |
"""Remove a member from a Group
|
| 698 |
|
python/src/workos/groups/models/create_group.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,11 +14,11 @@ class CreateGroup:
|
|
| 13 |
|
| 14 |
name: str
|
| 15 |
"""The name of the Group."""
|
| 16 |
-
description:
|
| 17 |
"""An optional description of the Group."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class CreateGroup:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("CreateGroup", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["name"] = self.name
|
| 34 |
if self.description is not None:
|
| 35 |
result["description"] = self.description
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
name: str
|
| 16 |
"""The name of the Group."""
|
| 17 |
+
description: str | None = None
|
| 18 |
"""An optional description of the Group."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateGroup:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("CreateGroup", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["name"] = self.name
|
| 35 |
if self.description is not None:
|
| 36 |
result["description"] = self.description
|
python/src/workos/groups/models/create_group_membership.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class CreateGroupMembership:
|
|
| 15 |
"""The ID of the Organization Membership to add to the group."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class CreateGroupMembership:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("CreateGroupMembership", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["organization_membership_id"] = self.organization_membership_id
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The ID of the Organization Membership to add to the group."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateGroupMembership:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("CreateGroupMembership", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["organization_membership_id"] = self.organization_membership_id
|
| 32 |
return result
|
python/src/workos/groups/models/update_group.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from workos.authorization.models.update_authorization_permission import (
|
| 5 |
UpdateAuthorizationPermission,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from workos.authorization.models.update_authorization_permission import (
|
| 6 |
UpdateAuthorizationPermission,
|
| 7 |
)
|
python/src/workos/multi_factor_auth/_resource.py|
@@ -2,16 +2,11 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any,
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
-
from .models import (
|
| 12 |
-
AuthenticationChallengeVerifyResponse,
|
| 13 |
-
UserAuthenticationFactorEnrollResponse,
|
| 14 |
-
)
|
| 15 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 16 |
from workos.common.models.authentication_factor import AuthenticationFactor
|
| 17 |
from workos.common.models.authentication_factor_enrolled import (
|
|
@@ -21,13 +16,19 @@ from workos.common.models.authentication_factors_create_request_type import (
|
|
| 21 |
AuthenticationFactorsCreateRequestType,
|
| 22 |
)
|
| 23 |
from workos.common.models.pagination_order import PaginationOrder
|
|
|
|
| 24 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
class MultiFactorAuth:
|
| 28 |
"""Multi Factor Auth API resources."""
|
| 29 |
|
| 30 |
-
def __init__(self, client:
|
| 31 |
self._client = client
|
| 32 |
|
| 33 |
def verify_challenge(
|
|
@@ -35,7 +36,7 @@ class MultiFactorAuth:
|
|
| 35 |
id: str,
|
| 36 |
*,
|
| 37 |
code: str,
|
| 38 |
-
request_options:
|
| 39 |
) -> AuthenticationChallengeVerifyResponse:
|
| 40 |
"""Verify Challenge
|
| 41 |
|
|
@@ -57,7 +58,7 @@ class MultiFactorAuth:
|
|
| 57 |
RateLimitExceededError: If rate limited (429).
|
| 58 |
ServerError: If the server returns a 5xx error.
|
| 59 |
"""
|
| 60 |
-
body:
|
| 61 |
"code": code,
|
| 62 |
}
|
| 63 |
return self._client.request(
|
|
@@ -71,12 +72,12 @@ class MultiFactorAuth:
|
|
| 71 |
def enroll_factor(
|
| 72 |
self,
|
| 73 |
*,
|
| 74 |
-
type:
|
| 75 |
-
phone_number:
|
| 76 |
-
totp_issuer:
|
| 77 |
-
totp_user:
|
| 78 |
-
user_id:
|
| 79 |
-
request_options:
|
| 80 |
) -> AuthenticationFactorEnrolled:
|
| 81 |
"""Enroll Factor
|
| 82 |
|
|
@@ -99,7 +100,7 @@ class MultiFactorAuth:
|
|
| 99 |
RateLimitExceededError: If rate limited (429).
|
| 100 |
ServerError: If the server returns a 5xx error.
|
| 101 |
"""
|
| 102 |
-
body:
|
| 103 |
k: v
|
| 104 |
for k, v in {
|
| 105 |
"type": enum_value(type),
|
|
@@ -122,7 +123,7 @@ class MultiFactorAuth:
|
|
| 122 |
self,
|
| 123 |
id: str,
|
| 124 |
*,
|
| 125 |
-
request_options:
|
| 126 |
) -> AuthenticationFactor:
|
| 127 |
"""Get Factor
|
| 128 |
|
|
@@ -152,7 +153,7 @@ class MultiFactorAuth:
|
|
| 152 |
self,
|
| 153 |
id: str,
|
| 154 |
*,
|
| 155 |
-
request_options:
|
| 156 |
) -> None:
|
| 157 |
"""Delete Factor
|
| 158 |
|
|
@@ -178,8 +179,8 @@ class MultiFactorAuth:
|
|
| 178 |
self,
|
| 179 |
id: str,
|
| 180 |
*,
|
| 181 |
-
sms_template:
|
| 182 |
-
request_options:
|
| 183 |
) -> AuthenticationChallenge:
|
| 184 |
"""Challenge Factor
|
| 185 |
|
|
@@ -200,7 +201,7 @@ class MultiFactorAuth:
|
|
| 200 |
RateLimitExceededError: If rate limited (429).
|
| 201 |
ServerError: If the server returns a 5xx error.
|
| 202 |
"""
|
| 203 |
-
body:
|
| 204 |
k: v
|
| 205 |
for k, v in {
|
| 206 |
"sms_template": sms_template,
|
|
@@ -219,11 +220,11 @@ class MultiFactorAuth:
|
|
| 219 |
self,
|
| 220 |
userland_user_id: str,
|
| 221 |
*,
|
| 222 |
-
limit:
|
| 223 |
-
before:
|
| 224 |
-
after:
|
| 225 |
-
order:
|
| 226 |
-
request_options:
|
| 227 |
) -> SyncPage[AuthenticationFactor]:
|
| 228 |
"""List authentication factors
|
| 229 |
|
|
@@ -269,10 +270,10 @@ class MultiFactorAuth:
|
|
| 269 |
userland_user_id: str,
|
| 270 |
*,
|
| 271 |
type: Literal["totp"],
|
| 272 |
-
totp_issuer:
|
| 273 |
-
totp_user:
|
| 274 |
-
totp_secret:
|
| 275 |
-
request_options:
|
| 276 |
) -> UserAuthenticationFactorEnrollResponse:
|
| 277 |
"""Enroll an authentication factor
|
| 278 |
|
|
@@ -295,7 +296,7 @@ class MultiFactorAuth:
|
|
| 295 |
RateLimitExceededError: If rate limited (429).
|
| 296 |
ServerError: If the server returns a 5xx error.
|
| 297 |
"""
|
| 298 |
-
body:
|
| 299 |
k: v
|
| 300 |
for k, v in {
|
| 301 |
"type": type,
|
|
@@ -317,7 +318,7 @@ class MultiFactorAuth:
|
|
| 317 |
class AsyncMultiFactorAuth:
|
| 318 |
"""Multi Factor Auth API resources (async)."""
|
| 319 |
|
| 320 |
-
def __init__(self, client:
|
| 321 |
self._client = client
|
| 322 |
|
| 323 |
async def verify_challenge(
|
|
@@ -325,7 +326,7 @@ class AsyncMultiFactorAuth:
|
|
| 325 |
id: str,
|
| 326 |
*,
|
| 327 |
code: str,
|
| 328 |
-
request_options:
|
| 329 |
) -> AuthenticationChallengeVerifyResponse:
|
| 330 |
"""Verify Challenge
|
| 331 |
|
|
@@ -347,7 +348,7 @@ class AsyncMultiFactorAuth:
|
|
| 347 |
RateLimitExceededError: If rate limited (429).
|
| 348 |
ServerError: If the server returns a 5xx error.
|
| 349 |
"""
|
| 350 |
-
body:
|
| 351 |
"code": code,
|
| 352 |
}
|
| 353 |
return await self._client.request(
|
|
@@ -361,12 +362,12 @@ class AsyncMultiFactorAuth:
|
|
| 361 |
async def enroll_factor(
|
| 362 |
self,
|
| 363 |
*,
|
| 364 |
-
type:
|
| 365 |
-
phone_number:
|
| 366 |
-
totp_issuer:
|
| 367 |
-
totp_user:
|
| 368 |
-
user_id:
|
| 369 |
-
request_options:
|
| 370 |
) -> AuthenticationFactorEnrolled:
|
| 371 |
"""Enroll Factor
|
| 372 |
|
|
@@ -389,7 +390,7 @@ class AsyncMultiFactorAuth:
|
|
| 389 |
RateLimitExceededError: If rate limited (429).
|
| 390 |
ServerError: If the server returns a 5xx error.
|
| 391 |
"""
|
| 392 |
-
body:
|
| 393 |
k: v
|
| 394 |
for k, v in {
|
| 395 |
"type": enum_value(type),
|
|
@@ -412,7 +413,7 @@ class AsyncMultiFactorAuth:
|
|
| 412 |
self,
|
| 413 |
id: str,
|
| 414 |
*,
|
| 415 |
-
request_options:
|
| 416 |
) -> AuthenticationFactor:
|
| 417 |
"""Get Factor
|
| 418 |
|
|
@@ -442,7 +443,7 @@ class AsyncMultiFactorAuth:
|
|
| 442 |
self,
|
| 443 |
id: str,
|
| 444 |
*,
|
| 445 |
-
request_options:
|
| 446 |
) -> None:
|
| 447 |
"""Delete Factor
|
| 448 |
|
|
@@ -468,8 +469,8 @@ class AsyncMultiFactorAuth:
|
|
| 468 |
self,
|
| 469 |
id: str,
|
| 470 |
*,
|
| 471 |
-
sms_template:
|
| 472 |
-
request_options:
|
| 473 |
) -> AuthenticationChallenge:
|
| 474 |
"""Challenge Factor
|
| 475 |
|
|
@@ -490,7 +491,7 @@ class AsyncMultiFactorAuth:
|
|
| 490 |
RateLimitExceededError: If rate limited (429).
|
| 491 |
ServerError: If the server returns a 5xx error.
|
| 492 |
"""
|
| 493 |
-
body:
|
| 494 |
k: v
|
| 495 |
for k, v in {
|
| 496 |
"sms_template": sms_template,
|
|
@@ -509,11 +510,11 @@ class AsyncMultiFactorAuth:
|
|
| 509 |
self,
|
| 510 |
userland_user_id: str,
|
| 511 |
*,
|
| 512 |
-
limit:
|
| 513 |
-
before:
|
| 514 |
-
after:
|
| 515 |
-
order:
|
| 516 |
-
request_options:
|
| 517 |
) -> AsyncPage[AuthenticationFactor]:
|
| 518 |
"""List authentication factors
|
| 519 |
|
|
@@ -559,10 +560,10 @@ class AsyncMultiFactorAuth:
|
|
| 559 |
userland_user_id: str,
|
| 560 |
*,
|
| 561 |
type: Literal["totp"],
|
| 562 |
-
totp_issuer:
|
| 563 |
-
totp_user:
|
| 564 |
-
totp_secret:
|
| 565 |
-
request_options:
|
| 566 |
) -> UserAuthenticationFactorEnrollResponse:
|
| 567 |
"""Enroll an authentication factor
|
| 568 |
|
|
@@ -585,7 +586,7 @@ class AsyncMultiFactorAuth:
|
|
| 585 |
RateLimitExceededError: If rate limited (429).
|
| 586 |
ServerError: If the server returns a 5xx error.
|
| 587 |
"""
|
| 588 |
-
body:
|
| 589 |
k: v
|
| 590 |
for k, v in {
|
| 591 |
"type": type,
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 11 |
from workos.common.models.authentication_factor import AuthenticationFactor
|
| 12 |
from workos.common.models.authentication_factor_enrolled import (
|
|
|
|
| 16 |
AuthenticationFactorsCreateRequestType,
|
| 17 |
)
|
| 18 |
from workos.common.models.pagination_order import PaginationOrder
|
| 19 |
+
|
| 20 |
from .._pagination import AsyncPage, SyncPage
|
| 21 |
+
from .._types import RequestOptions, enum_value
|
| 22 |
+
from .models import (
|
| 23 |
+
AuthenticationChallengeVerifyResponse,
|
| 24 |
+
UserAuthenticationFactorEnrollResponse,
|
| 25 |
+
)
|
| 26 |
|
| 27 |
|
| 28 |
class MultiFactorAuth:
|
| 29 |
"""Multi Factor Auth API resources."""
|
| 30 |
|
| 31 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 32 |
self._client = client
|
| 33 |
|
| 34 |
def verify_challenge(
|
|
|
|
| 36 |
id: str,
|
| 37 |
*,
|
| 38 |
code: str,
|
| 39 |
+
request_options: RequestOptions | None = None,
|
| 40 |
) -> AuthenticationChallengeVerifyResponse:
|
| 41 |
"""Verify Challenge
|
| 42 |
|
|
|
|
| 58 |
RateLimitExceededError: If rate limited (429).
|
| 59 |
ServerError: If the server returns a 5xx error.
|
| 60 |
"""
|
| 61 |
+
body: dict[str, Any] = {
|
| 62 |
"code": code,
|
| 63 |
}
|
| 64 |
return self._client.request(
|
|
|
|
| 72 |
def enroll_factor(
|
| 73 |
self,
|
| 74 |
*,
|
| 75 |
+
type: AuthenticationFactorsCreateRequestType | str,
|
| 76 |
+
phone_number: str | None = None,
|
| 77 |
+
totp_issuer: str | None = None,
|
| 78 |
+
totp_user: str | None = None,
|
| 79 |
+
user_id: str | None = None,
|
| 80 |
+
request_options: RequestOptions | None = None,
|
| 81 |
) -> AuthenticationFactorEnrolled:
|
| 82 |
"""Enroll Factor
|
| 83 |
|
|
|
|
| 100 |
RateLimitExceededError: If rate limited (429).
|
| 101 |
ServerError: If the server returns a 5xx error.
|
| 102 |
"""
|
| 103 |
+
body: dict[str, Any] = {
|
| 104 |
k: v
|
| 105 |
for k, v in {
|
| 106 |
"type": enum_value(type),
|
|
|
|
| 123 |
self,
|
| 124 |
id: str,
|
| 125 |
*,
|
| 126 |
+
request_options: RequestOptions | None = None,
|
| 127 |
) -> AuthenticationFactor:
|
| 128 |
"""Get Factor
|
| 129 |
|
|
|
|
| 153 |
self,
|
| 154 |
id: str,
|
| 155 |
*,
|
| 156 |
+
request_options: RequestOptions | None = None,
|
| 157 |
) -> None:
|
| 158 |
"""Delete Factor
|
| 159 |
|
|
|
|
| 179 |
self,
|
| 180 |
id: str,
|
| 181 |
*,
|
| 182 |
+
sms_template: str | None = None,
|
| 183 |
+
request_options: RequestOptions | None = None,
|
| 184 |
) -> AuthenticationChallenge:
|
| 185 |
"""Challenge Factor
|
| 186 |
|
|
|
|
| 201 |
RateLimitExceededError: If rate limited (429).
|
| 202 |
ServerError: If the server returns a 5xx error.
|
| 203 |
"""
|
| 204 |
+
body: dict[str, Any] = {
|
| 205 |
k: v
|
| 206 |
for k, v in {
|
| 207 |
"sms_template": sms_template,
|
|
|
|
| 220 |
self,
|
| 221 |
userland_user_id: str,
|
| 222 |
*,
|
| 223 |
+
limit: int | None = None,
|
| 224 |
+
before: str | None = None,
|
| 225 |
+
after: str | None = None,
|
| 226 |
+
order: PaginationOrder | str | None = "desc",
|
| 227 |
+
request_options: RequestOptions | None = None,
|
| 228 |
) -> SyncPage[AuthenticationFactor]:
|
| 229 |
"""List authentication factors
|
| 230 |
|
|
|
|
| 270 |
userland_user_id: str,
|
| 271 |
*,
|
| 272 |
type: Literal["totp"],
|
| 273 |
+
totp_issuer: str | None = None,
|
| 274 |
+
totp_user: str | None = None,
|
| 275 |
+
totp_secret: str | None = None,
|
| 276 |
+
request_options: RequestOptions | None = None,
|
| 277 |
) -> UserAuthenticationFactorEnrollResponse:
|
| 278 |
"""Enroll an authentication factor
|
| 279 |
|
|
|
|
| 296 |
RateLimitExceededError: If rate limited (429).
|
| 297 |
ServerError: If the server returns a 5xx error.
|
| 298 |
"""
|
| 299 |
+
body: dict[str, Any] = {
|
| 300 |
k: v
|
| 301 |
for k, v in {
|
| 302 |
"type": type,
|
|
|
|
| 318 |
class AsyncMultiFactorAuth:
|
| 319 |
"""Multi Factor Auth API resources (async)."""
|
| 320 |
|
| 321 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 322 |
self._client = client
|
| 323 |
|
| 324 |
async def verify_challenge(
|
|
|
|
| 326 |
id: str,
|
| 327 |
*,
|
| 328 |
code: str,
|
| 329 |
+
request_options: RequestOptions | None = None,
|
| 330 |
) -> AuthenticationChallengeVerifyResponse:
|
| 331 |
"""Verify Challenge
|
| 332 |
|
|
|
|
| 348 |
RateLimitExceededError: If rate limited (429).
|
| 349 |
ServerError: If the server returns a 5xx error.
|
| 350 |
"""
|
| 351 |
+
body: dict[str, Any] = {
|
| 352 |
"code": code,
|
| 353 |
}
|
| 354 |
return await self._client.request(
|
|
|
|
| 362 |
async def enroll_factor(
|
| 363 |
self,
|
| 364 |
*,
|
| 365 |
+
type: AuthenticationFactorsCreateRequestType | str,
|
| 366 |
+
phone_number: str | None = None,
|
| 367 |
+
totp_issuer: str | None = None,
|
| 368 |
+
totp_user: str | None = None,
|
| 369 |
+
user_id: str | None = None,
|
| 370 |
+
request_options: RequestOptions | None = None,
|
| 371 |
) -> AuthenticationFactorEnrolled:
|
| 372 |
"""Enroll Factor
|
| 373 |
|
|
|
|
| 390 |
RateLimitExceededError: If rate limited (429).
|
| 391 |
ServerError: If the server returns a 5xx error.
|
| 392 |
"""
|
| 393 |
+
body: dict[str, Any] = {
|
| 394 |
k: v
|
| 395 |
for k, v in {
|
| 396 |
"type": enum_value(type),
|
|
|
|
| 413 |
self,
|
| 414 |
id: str,
|
| 415 |
*,
|
| 416 |
+
request_options: RequestOptions | None = None,
|
| 417 |
) -> AuthenticationFactor:
|
| 418 |
"""Get Factor
|
| 419 |
|
|
|
|
| 443 |
self,
|
| 444 |
id: str,
|
| 445 |
*,
|
| 446 |
+
request_options: RequestOptions | None = None,
|
| 447 |
) -> None:
|
| 448 |
"""Delete Factor
|
| 449 |
|
|
|
|
| 469 |
self,
|
| 470 |
id: str,
|
| 471 |
*,
|
| 472 |
+
sms_template: str | None = None,
|
| 473 |
+
request_options: RequestOptions | None = None,
|
| 474 |
) -> AuthenticationChallenge:
|
| 475 |
"""Challenge Factor
|
| 476 |
|
|
|
|
| 491 |
RateLimitExceededError: If rate limited (429).
|
| 492 |
ServerError: If the server returns a 5xx error.
|
| 493 |
"""
|
| 494 |
+
body: dict[str, Any] = {
|
| 495 |
k: v
|
| 496 |
for k, v in {
|
| 497 |
"sms_template": sms_template,
|
|
|
|
| 510 |
self,
|
| 511 |
userland_user_id: str,
|
| 512 |
*,
|
| 513 |
+
limit: int | None = None,
|
| 514 |
+
before: str | None = None,
|
| 515 |
+
after: str | None = None,
|
| 516 |
+
order: PaginationOrder | str | None = "desc",
|
| 517 |
+
request_options: RequestOptions | None = None,
|
| 518 |
) -> AsyncPage[AuthenticationFactor]:
|
| 519 |
"""List authentication factors
|
| 520 |
|
|
|
|
| 560 |
userland_user_id: str,
|
| 561 |
*,
|
| 562 |
type: Literal["totp"],
|
| 563 |
+
totp_issuer: str | None = None,
|
| 564 |
+
totp_user: str | None = None,
|
| 565 |
+
totp_secret: str | None = None,
|
| 566 |
+
request_options: RequestOptions | None = None,
|
| 567 |
) -> UserAuthenticationFactorEnrollResponse:
|
| 568 |
"""Enroll an authentication factor
|
| 569 |
|
|
|
|
| 586 |
RateLimitExceededError: If rate limited (429).
|
| 587 |
ServerError: If the server returns a 5xx error.
|
| 588 |
"""
|
| 589 |
+
body: dict[str, Any] = {
|
| 590 |
k: v
|
| 591 |
for k, v in {
|
| 592 |
"type": type,
|
python/src/workos/multi_factor_auth/models/authentication_challenge_verify_response.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
| 8 |
-
from workos._types import _raise_deserialize_error
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 11 |
|
| 12 |
|
|
@@ -14,27 +13,27 @@ from workos.common.models.authentication_challenge import AuthenticationChalleng
|
|
| 14 |
class AuthenticationChallengeVerifyResponse:
|
| 15 |
"""Authentication Challenge Verify Response model."""
|
| 16 |
|
| 17 |
-
challenge:
|
| 18 |
"""The authentication challenge object."""
|
| 19 |
valid: bool
|
| 20 |
"""Whether the code was valid."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
challenge=AuthenticationChallenge.from_dict(
|
| 28 |
-
cast(
|
| 29 |
),
|
| 30 |
valid=data["valid"],
|
| 31 |
)
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("AuthenticationChallengeVerifyResponse", e)
|
| 34 |
|
| 35 |
-
def to_dict(self) ->
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
-
result:
|
| 38 |
result["challenge"] = self.challenge.to_dict()
|
| 39 |
result["valid"] = self.valid
|
| 40 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
|
|
|
| 7 |
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 10 |
|
| 11 |
|
|
|
|
| 13 |
class AuthenticationChallengeVerifyResponse:
|
| 14 |
"""Authentication Challenge Verify Response model."""
|
| 15 |
|
| 16 |
+
challenge: AuthenticationChallenge
|
| 17 |
"""The authentication challenge object."""
|
| 18 |
valid: bool
|
| 19 |
"""Whether the code was valid."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationChallengeVerifyResponse:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
| 26 |
challenge=AuthenticationChallenge.from_dict(
|
| 27 |
+
cast(dict[str, Any], data["challenge"])
|
| 28 |
),
|
| 29 |
valid=data["valid"],
|
| 30 |
)
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("AuthenticationChallengeVerifyResponse", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["challenge"] = self.challenge.to_dict()
|
| 38 |
result["valid"] = self.valid
|
| 39 |
return result
|
python/src/workos/multi_factor_auth/models/authentication_challenges_verify_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class AuthenticationChallengesVerifyRequest:
|
|
| 15 |
"""The one-time code to verify."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class AuthenticationChallengesVerifyRequest:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuthenticationChallengesVerifyRequest", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["code"] = self.code
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The one-time code to verify."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationChallengesVerifyRequest:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuthenticationChallengesVerifyRequest", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["code"] = self.code
|
| 32 |
return result
|
python/src/workos/multi_factor_auth/models/authentication_factors_create_request.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.authentication_factors_create_request_type import (
|
| 10 |
AuthenticationFactorsCreateRequestType,
|
|
@@ -15,19 +16,19 @@ from workos.common.models.authentication_factors_create_request_type import (
|
|
| 15 |
class AuthenticationFactorsCreateRequest:
|
| 16 |
"""Authentication Factors Create Request model."""
|
| 17 |
|
| 18 |
-
type:
|
| 19 |
"""The type of factor to enroll."""
|
| 20 |
-
phone_number:
|
| 21 |
"""Required when type is 'sms'."""
|
| 22 |
-
totp_issuer:
|
| 23 |
"""Required when type is 'totp'."""
|
| 24 |
-
totp_user:
|
| 25 |
"""Required when type is 'totp'."""
|
| 26 |
-
user_id:
|
| 27 |
"""The ID of the user to associate the factor with."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -40,9 +41,9 @@ class AuthenticationFactorsCreateRequest:
|
|
| 40 |
except (KeyError, ValueError) as e:
|
| 41 |
_raise_deserialize_error("AuthenticationFactorsCreateRequest", e)
|
| 42 |
|
| 43 |
-
def to_dict(self) ->
|
| 44 |
"""Serialize to a dictionary."""
|
| 45 |
-
result:
|
| 46 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 47 |
if self.phone_number is not None:
|
| 48 |
result["phone_number"] = self.phone_number
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.authentication_factors_create_request_type import (
|
| 11 |
AuthenticationFactorsCreateRequestType,
|
|
|
|
| 16 |
class AuthenticationFactorsCreateRequest:
|
| 17 |
"""Authentication Factors Create Request model."""
|
| 18 |
|
| 19 |
+
type: AuthenticationFactorsCreateRequestType
|
| 20 |
"""The type of factor to enroll."""
|
| 21 |
+
phone_number: str | None = None
|
| 22 |
"""Required when type is 'sms'."""
|
| 23 |
+
totp_issuer: str | None = None
|
| 24 |
"""Required when type is 'totp'."""
|
| 25 |
+
totp_user: str | None = None
|
| 26 |
"""Required when type is 'totp'."""
|
| 27 |
+
user_id: str | None = None
|
| 28 |
"""The ID of the user to associate the factor with."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuthenticationFactorsCreateRequest:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 41 |
except (KeyError, ValueError) as e:
|
| 42 |
_raise_deserialize_error("AuthenticationFactorsCreateRequest", e)
|
| 43 |
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 48 |
if self.phone_number is not None:
|
| 49 |
result["phone_number"] = self.phone_number
|
python/src/workos/multi_factor_auth/models/challenge_authentication_factor.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class ChallengeAuthenticationFactor:
|
| 12 |
"""Challenge Authentication Factor model."""
|
| 13 |
|
| 14 |
-
sms_template:
|
| 15 |
"""A custom template for the SMS message. Use the {{code}} placeholder to include the verification code."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,9 +25,9 @@ class ChallengeAuthenticationFactor:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("ChallengeAuthenticationFactor", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
if self.sms_template is not None:
|
| 31 |
result["sms_template"] = self.sms_template
|
| 32 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class ChallengeAuthenticationFactor:
|
| 13 |
"""Challenge Authentication Factor model."""
|
| 14 |
|
| 15 |
+
sms_template: str | None = None
|
| 16 |
"""A custom template for the SMS message. Use the {{code}} placeholder to include the verification code."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> ChallengeAuthenticationFactor:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("ChallengeAuthenticationFactor", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
if self.sms_template is not None:
|
| 32 |
result["sms_template"] = self.sms_template
|
| 33 |
return result
|
python/src/workos/multi_factor_auth/models/enroll_user_authentication_factor.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,15 +14,15 @@ class EnrollUserAuthenticationFactor:
|
|
| 13 |
|
| 14 |
type: Literal["totp"]
|
| 15 |
"""The type of the factor to enroll."""
|
| 16 |
-
totp_issuer:
|
| 17 |
"""Your application or company name displayed in the user's authenticator app."""
|
| 18 |
-
totp_user:
|
| 19 |
"""The user's account name displayed in their authenticator app."""
|
| 20 |
-
totp_secret:
|
| 21 |
"""The Base32-encoded shared secret for TOTP factors. This can be provided when creating the auth factor, otherwise it will be generated. The algorithm used to derive TOTP codes is SHA-1, the code length is 6 digits, and the timestep is 30 seconds โ the secret must be compatible with these parameters."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class EnrollUserAuthenticationFactor:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("EnrollUserAuthenticationFactor", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["type"] = self.type
|
| 40 |
if self.totp_issuer is not None:
|
| 41 |
result["totp_issuer"] = self.totp_issuer
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
type: Literal["totp"]
|
| 16 |
"""The type of the factor to enroll."""
|
| 17 |
+
totp_issuer: str | None = None
|
| 18 |
"""Your application or company name displayed in the user's authenticator app."""
|
| 19 |
+
totp_user: str | None = None
|
| 20 |
"""The user's account name displayed in their authenticator app."""
|
| 21 |
+
totp_secret: str | None = None
|
| 22 |
"""The Base32-encoded shared secret for TOTP factors. This can be provided when creating the auth factor, otherwise it will be generated. The algorithm used to derive TOTP codes is SHA-1, the code length is 6 digits, and the timestep is 30 seconds โ the secret must be compatible with these parameters."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> EnrollUserAuthenticationFactor:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("EnrollUserAuthenticationFactor", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["type"] = self.type
|
| 41 |
if self.totp_issuer is not None:
|
| 42 |
result["totp_issuer"] = self.totp_issuer
|
python/src/workos/multi_factor_auth/models/user_authentication_factor_enroll_response.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
| 8 |
-
from workos._types import _raise_deserialize_error
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 11 |
from workos.common.models.authentication_factor_enrolled import (
|
| 12 |
AuthenticationFactorEnrolled,
|
|
@@ -17,31 +16,29 @@ from workos.common.models.authentication_factor_enrolled import (
|
|
| 17 |
class UserAuthenticationFactorEnrollResponse:
|
| 18 |
"""User Authentication Factor Enroll Response model."""
|
| 19 |
|
| 20 |
-
authentication_factor:
|
| 21 |
"""The [authentication factor](https://workos.com/docs/reference/authkit/mfa/authentication-factor) object that represents the additional authentication method used on top of the existing authentication strategy."""
|
| 22 |
-
authentication_challenge:
|
| 23 |
"""The [authentication challenge](https://workos.com/docs/reference/authkit/mfa/authentication-challenge) object that is used to complete the authentication process."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(
|
| 27 |
-
cls, data: Dict[str, Any]
|
| 28 |
-
) ->
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
| 32 |
authentication_factor=AuthenticationFactorEnrolled.from_dict(
|
| 33 |
-
cast(
|
| 34 |
),
|
| 35 |
authentication_challenge=AuthenticationChallenge.from_dict(
|
| 36 |
-
cast(
|
| 37 |
),
|
| 38 |
)
|
| 39 |
except (KeyError, ValueError) as e:
|
| 40 |
_raise_deserialize_error("UserAuthenticationFactorEnrollResponse", e)
|
| 41 |
|
| 42 |
-
def to_dict(self) ->
|
| 43 |
"""Serialize to a dictionary."""
|
| 44 |
-
result:
|
| 45 |
result["authentication_factor"] = self.authentication_factor.to_dict()
|
| 46 |
result["authentication_challenge"] = self.authentication_challenge.to_dict()
|
| 47 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
|
|
|
| 7 |
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.authentication_challenge import AuthenticationChallenge
|
| 10 |
from workos.common.models.authentication_factor_enrolled import (
|
| 11 |
AuthenticationFactorEnrolled,
|
|
|
|
| 16 |
class UserAuthenticationFactorEnrollResponse:
|
| 17 |
"""User Authentication Factor Enroll Response model."""
|
| 18 |
|
| 19 |
+
authentication_factor: AuthenticationFactorEnrolled
|
| 20 |
"""The [authentication factor](https://workos.com/docs/reference/authkit/mfa/authentication-factor) object that represents the additional authentication method used on top of the existing authentication strategy."""
|
| 21 |
+
authentication_challenge: AuthenticationChallenge
|
| 22 |
"""The [authentication challenge](https://workos.com/docs/reference/authkit/mfa/authentication-challenge) object that is used to complete the authentication process."""
|
| 23 |
|
| 24 |
@classmethod
|
|
|
|
|
|
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> UserAuthenticationFactorEnrollResponse:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
| 29 |
authentication_factor=AuthenticationFactorEnrolled.from_dict(
|
| 30 |
+
cast(dict[str, Any], data["authentication_factor"])
|
| 31 |
),
|
| 32 |
authentication_challenge=AuthenticationChallenge.from_dict(
|
| 33 |
+
cast(dict[str, Any], data["authentication_challenge"])
|
| 34 |
),
|
| 35 |
)
|
| 36 |
except (KeyError, ValueError) as e:
|
| 37 |
_raise_deserialize_error("UserAuthenticationFactorEnrollResponse", e)
|
| 38 |
|
| 39 |
+
def to_dict(self) -> dict[str, Any]:
|
| 40 |
"""Serialize to a dictionary."""
|
| 41 |
+
result: dict[str, Any] = {}
|
| 42 |
result["authentication_factor"] = self.authentication_factor.to_dict()
|
| 43 |
result["authentication_challenge"] = self.authentication_challenge.to_dict()
|
| 44 |
return result
|
python/src/workos/organization_domains/_resource.py|
@@ -2,19 +2,20 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions
|
| 11 |
from workos.common.models.organization_domain import OrganizationDomain
|
| 12 |
|
|
|
|
|
|
|
| 13 |
|
| 14 |
class OrganizationDomains:
|
| 15 |
"""Organization Domains API resources."""
|
| 16 |
|
| 17 |
-
def __init__(self, client:
|
| 18 |
self._client = client
|
| 19 |
|
| 20 |
def create_organization_domain(
|
|
@@ -22,7 +23,7 @@ class OrganizationDomains:
|
|
| 22 |
*,
|
| 23 |
domain: str,
|
| 24 |
organization_id: str,
|
| 25 |
-
request_options:
|
| 26 |
) -> OrganizationDomain:
|
| 27 |
"""Create an Organization Domain
|
| 28 |
|
|
@@ -42,7 +43,7 @@ class OrganizationDomains:
|
|
| 42 |
RateLimitExceededError: If rate limited (429).
|
| 43 |
ServerError: If the server returns a 5xx error.
|
| 44 |
"""
|
| 45 |
-
body:
|
| 46 |
"domain": domain,
|
| 47 |
"organization_id": organization_id,
|
| 48 |
}
|
|
@@ -58,7 +59,7 @@ class OrganizationDomains:
|
|
| 58 |
self,
|
| 59 |
id: str,
|
| 60 |
*,
|
| 61 |
-
request_options:
|
| 62 |
) -> OrganizationDomain:
|
| 63 |
"""Get an Organization Domain
|
| 64 |
|
|
@@ -88,7 +89,7 @@ class OrganizationDomains:
|
|
| 88 |
self,
|
| 89 |
id: str,
|
| 90 |
*,
|
| 91 |
-
request_options:
|
| 92 |
) -> None:
|
| 93 |
"""Delete an Organization Domain
|
| 94 |
|
|
@@ -114,7 +115,7 @@ class OrganizationDomains:
|
|
| 114 |
self,
|
| 115 |
id: str,
|
| 116 |
*,
|
| 117 |
-
request_options:
|
| 118 |
) -> OrganizationDomain:
|
| 119 |
"""Verify an Organization Domain
|
| 120 |
|
|
@@ -144,7 +145,7 @@ class OrganizationDomains:
|
|
| 144 |
class AsyncOrganizationDomains:
|
| 145 |
"""Organization Domains API resources (async)."""
|
| 146 |
|
| 147 |
-
def __init__(self, client:
|
| 148 |
self._client = client
|
| 149 |
|
| 150 |
async def create_organization_domain(
|
|
@@ -152,7 +153,7 @@ class AsyncOrganizationDomains:
|
|
| 152 |
*,
|
| 153 |
domain: str,
|
| 154 |
organization_id: str,
|
| 155 |
-
request_options:
|
| 156 |
) -> OrganizationDomain:
|
| 157 |
"""Create an Organization Domain
|
| 158 |
|
|
@@ -172,7 +173,7 @@ class AsyncOrganizationDomains:
|
|
| 172 |
RateLimitExceededError: If rate limited (429).
|
| 173 |
ServerError: If the server returns a 5xx error.
|
| 174 |
"""
|
| 175 |
-
body:
|
| 176 |
"domain": domain,
|
| 177 |
"organization_id": organization_id,
|
| 178 |
}
|
|
@@ -188,7 +189,7 @@ class AsyncOrganizationDomains:
|
|
| 188 |
self,
|
| 189 |
id: str,
|
| 190 |
*,
|
| 191 |
-
request_options:
|
| 192 |
) -> OrganizationDomain:
|
| 193 |
"""Get an Organization Domain
|
| 194 |
|
|
@@ -218,7 +219,7 @@ class AsyncOrganizationDomains:
|
|
| 218 |
self,
|
| 219 |
id: str,
|
| 220 |
*,
|
| 221 |
-
request_options:
|
| 222 |
) -> None:
|
| 223 |
"""Delete an Organization Domain
|
| 224 |
|
|
@@ -244,7 +245,7 @@ class AsyncOrganizationDomains:
|
|
| 244 |
self,
|
| 245 |
id: str,
|
| 246 |
*,
|
| 247 |
-
request_options:
|
| 248 |
) -> OrganizationDomain:
|
| 249 |
"""Verify an Organization Domain
|
| 250 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.organization_domain import OrganizationDomain
|
| 11 |
|
| 12 |
+
from .._types import RequestOptions
|
| 13 |
+
|
| 14 |
|
| 15 |
class OrganizationDomains:
|
| 16 |
"""Organization Domains API resources."""
|
| 17 |
|
| 18 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 19 |
self._client = client
|
| 20 |
|
| 21 |
def create_organization_domain(
|
|
|
|
| 23 |
*,
|
| 24 |
domain: str,
|
| 25 |
organization_id: str,
|
| 26 |
+
request_options: RequestOptions | None = None,
|
| 27 |
) -> OrganizationDomain:
|
| 28 |
"""Create an Organization Domain
|
| 29 |
|
|
|
|
| 43 |
RateLimitExceededError: If rate limited (429).
|
| 44 |
ServerError: If the server returns a 5xx error.
|
| 45 |
"""
|
| 46 |
+
body: dict[str, Any] = {
|
| 47 |
"domain": domain,
|
| 48 |
"organization_id": organization_id,
|
| 49 |
}
|
|
|
|
| 59 |
self,
|
| 60 |
id: str,
|
| 61 |
*,
|
| 62 |
+
request_options: RequestOptions | None = None,
|
| 63 |
) -> OrganizationDomain:
|
| 64 |
"""Get an Organization Domain
|
| 65 |
|
|
|
|
| 89 |
self,
|
| 90 |
id: str,
|
| 91 |
*,
|
| 92 |
+
request_options: RequestOptions | None = None,
|
| 93 |
) -> None:
|
| 94 |
"""Delete an Organization Domain
|
| 95 |
|
|
|
|
| 115 |
self,
|
| 116 |
id: str,
|
| 117 |
*,
|
| 118 |
+
request_options: RequestOptions | None = None,
|
| 119 |
) -> OrganizationDomain:
|
| 120 |
"""Verify an Organization Domain
|
| 121 |
|
|
|
|
| 145 |
class AsyncOrganizationDomains:
|
| 146 |
"""Organization Domains API resources (async)."""
|
| 147 |
|
| 148 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 149 |
self._client = client
|
| 150 |
|
| 151 |
async def create_organization_domain(
|
|
|
|
| 153 |
*,
|
| 154 |
domain: str,
|
| 155 |
organization_id: str,
|
| 156 |
+
request_options: RequestOptions | None = None,
|
| 157 |
) -> OrganizationDomain:
|
| 158 |
"""Create an Organization Domain
|
| 159 |
|
|
|
|
| 173 |
RateLimitExceededError: If rate limited (429).
|
| 174 |
ServerError: If the server returns a 5xx error.
|
| 175 |
"""
|
| 176 |
+
body: dict[str, Any] = {
|
| 177 |
"domain": domain,
|
| 178 |
"organization_id": organization_id,
|
| 179 |
}
|
|
|
|
| 189 |
self,
|
| 190 |
id: str,
|
| 191 |
*,
|
| 192 |
+
request_options: RequestOptions | None = None,
|
| 193 |
) -> OrganizationDomain:
|
| 194 |
"""Get an Organization Domain
|
| 195 |
|
|
|
|
| 219 |
self,
|
| 220 |
id: str,
|
| 221 |
*,
|
| 222 |
+
request_options: RequestOptions | None = None,
|
| 223 |
) -> None:
|
| 224 |
"""Delete an Organization Domain
|
| 225 |
|
|
|
|
| 245 |
self,
|
| 246 |
id: str,
|
| 247 |
*,
|
| 248 |
+
request_options: RequestOptions | None = None,
|
| 249 |
) -> OrganizationDomain:
|
| 250 |
"""Verify an Organization Domain
|
| 251 |
|
python/src/workos/organization_domains/models/create_organization_domain.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class CreateOrganizationDomain:
|
|
| 17 |
"""The ID of the organization to add the domain to."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class CreateOrganizationDomain:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("CreateOrganizationDomain", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["domain"] = self.domain
|
| 34 |
result["organization_id"] = self.organization_id
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""The ID of the organization to add the domain to."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationDomain:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("CreateOrganizationDomain", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["domain"] = self.domain
|
| 35 |
result["organization_id"] = self.organization_id
|
| 36 |
return result
|
python/src/workos/organization_membership/_resource.py|
@@ -2,18 +2,23 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from
|
| 11 |
-
|
| 12 |
from workos.common.models.group import Group
|
| 13 |
-
from .models import UserManagementOrganizationMembershipStatuses
|
| 14 |
from workos.common.models.pagination_order import PaginationOrder
|
|
|
|
| 15 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
| 16 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
@dataclass
|
|
@@ -27,28 +32,27 @@ class RoleSingle:
|
|
| 27 |
class RoleMultiple:
|
| 28 |
"""Identify role multiple."""
|
| 29 |
|
| 30 |
-
role_slugs:
|
| 31 |
|
| 32 |
|
| 33 |
class OrganizationMembershipService:
|
| 34 |
"""Organization Membership Service API resources."""
|
| 35 |
|
| 36 |
-
def __init__(self, client:
|
| 37 |
self._client = client
|
| 38 |
|
| 39 |
def list_organization_memberships(
|
| 40 |
self,
|
| 41 |
*,
|
| 42 |
-
limit:
|
| 43 |
-
before:
|
| 44 |
-
after:
|
| 45 |
-
order:
|
| 46 |
-
organization_id:
|
| 47 |
-
statuses: Optional[
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
user_id:
|
| 51 |
-
request_options:
|
| 52 |
) -> SyncPage[UserOrganizationMembership]:
|
| 53 |
"""List organization memberships
|
| 54 |
|
|
@@ -103,8 +107,8 @@ class OrganizationMembershipService:
|
|
| 103 |
*,
|
| 104 |
user_id: str,
|
| 105 |
organization_id: str,
|
| 106 |
-
role:
|
| 107 |
-
request_options:
|
| 108 |
) -> OrganizationMembership:
|
| 109 |
"""Create an organization membership
|
| 110 |
|
|
@@ -129,7 +133,7 @@ class OrganizationMembershipService:
|
|
| 129 |
RateLimitExceededError: If rate limited (429).
|
| 130 |
ServerError: If the server returns a 5xx error.
|
| 131 |
"""
|
| 132 |
-
body:
|
| 133 |
"user_id": user_id,
|
| 134 |
"organization_id": organization_id,
|
| 135 |
}
|
|
@@ -150,7 +154,7 @@ class OrganizationMembershipService:
|
|
| 150 |
self,
|
| 151 |
id: str,
|
| 152 |
*,
|
| 153 |
-
request_options:
|
| 154 |
) -> UserOrganizationMembership:
|
| 155 |
"""Get an organization membership
|
| 156 |
|
|
@@ -180,8 +184,8 @@ class OrganizationMembershipService:
|
|
| 180 |
self,
|
| 181 |
id: str,
|
| 182 |
*,
|
| 183 |
-
role:
|
| 184 |
-
request_options:
|
| 185 |
) -> UserOrganizationMembership:
|
| 186 |
"""Update an organization membership
|
| 187 |
|
|
@@ -202,7 +206,7 @@ class OrganizationMembershipService:
|
|
| 202 |
RateLimitExceededError: If rate limited (429).
|
| 203 |
ServerError: If the server returns a 5xx error.
|
| 204 |
"""
|
| 205 |
-
body:
|
| 206 |
if role is not None:
|
| 207 |
if isinstance(role, RoleSingle):
|
| 208 |
body["role_slug"] = role.role_slug
|
|
@@ -220,7 +224,7 @@ class OrganizationMembershipService:
|
|
| 220 |
self,
|
| 221 |
id: str,
|
| 222 |
*,
|
| 223 |
-
request_options:
|
| 224 |
) -> None:
|
| 225 |
"""Delete an organization membership
|
| 226 |
|
|
@@ -246,7 +250,7 @@ class OrganizationMembershipService:
|
|
| 246 |
self,
|
| 247 |
id: str,
|
| 248 |
*,
|
| 249 |
-
request_options:
|
| 250 |
) -> OrganizationMembership:
|
| 251 |
"""Deactivate an organization membership
|
| 252 |
|
|
@@ -283,7 +287,7 @@ class OrganizationMembershipService:
|
|
| 283 |
self,
|
| 284 |
id: str,
|
| 285 |
*,
|
| 286 |
-
request_options:
|
| 287 |
) -> UserOrganizationMembership:
|
| 288 |
"""Reactivate an organization membership
|
| 289 |
|
|
@@ -320,11 +324,11 @@ class OrganizationMembershipService:
|
|
| 320 |
self,
|
| 321 |
om_id: str,
|
| 322 |
*,
|
| 323 |
-
limit:
|
| 324 |
-
before:
|
| 325 |
-
after:
|
| 326 |
-
order:
|
| 327 |
-
request_options:
|
| 328 |
) -> SyncPage[Group]:
|
| 329 |
"""List groups
|
| 330 |
|
|
@@ -369,22 +373,21 @@ class OrganizationMembershipService:
|
|
| 369 |
class AsyncOrganizationMembershipService:
|
| 370 |
"""Organization Membership Service API resources (async)."""
|
| 371 |
|
| 372 |
-
def __init__(self, client:
|
| 373 |
self._client = client
|
| 374 |
|
| 375 |
async def list_organization_memberships(
|
| 376 |
self,
|
| 377 |
*,
|
| 378 |
-
limit:
|
| 379 |
-
before:
|
| 380 |
-
after:
|
| 381 |
-
order:
|
| 382 |
-
organization_id:
|
| 383 |
-
statuses: Optional[
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
user_id:
|
| 387 |
-
request_options:
|
| 388 |
) -> AsyncPage[UserOrganizationMembership]:
|
| 389 |
"""List organization memberships
|
| 390 |
|
|
@@ -439,8 +442,8 @@ class AsyncOrganizationMembershipService:
|
|
| 439 |
*,
|
| 440 |
user_id: str,
|
| 441 |
organization_id: str,
|
| 442 |
-
role:
|
| 443 |
-
request_options:
|
| 444 |
) -> OrganizationMembership:
|
| 445 |
"""Create an organization membership
|
| 446 |
|
|
@@ -465,7 +468,7 @@ class AsyncOrganizationMembershipService:
|
|
| 465 |
RateLimitExceededError: If rate limited (429).
|
| 466 |
ServerError: If the server returns a 5xx error.
|
| 467 |
"""
|
| 468 |
-
body:
|
| 469 |
"user_id": user_id,
|
| 470 |
"organization_id": organization_id,
|
| 471 |
}
|
|
@@ -486,7 +489,7 @@ class AsyncOrganizationMembershipService:
|
|
| 486 |
self,
|
| 487 |
id: str,
|
| 488 |
*,
|
| 489 |
-
request_options:
|
| 490 |
) -> UserOrganizationMembership:
|
| 491 |
"""Get an organization membership
|
| 492 |
|
|
@@ -516,8 +519,8 @@ class AsyncOrganizationMembershipService:
|
|
| 516 |
self,
|
| 517 |
id: str,
|
| 518 |
*,
|
| 519 |
-
role:
|
| 520 |
-
request_options:
|
| 521 |
) -> UserOrganizationMembership:
|
| 522 |
"""Update an organization membership
|
| 523 |
|
|
@@ -538,7 +541,7 @@ class AsyncOrganizationMembershipService:
|
|
| 538 |
RateLimitExceededError: If rate limited (429).
|
| 539 |
ServerError: If the server returns a 5xx error.
|
| 540 |
"""
|
| 541 |
-
body:
|
| 542 |
if role is not None:
|
| 543 |
if isinstance(role, RoleSingle):
|
| 544 |
body["role_slug"] = role.role_slug
|
|
@@ -556,7 +559,7 @@ class AsyncOrganizationMembershipService:
|
|
| 556 |
self,
|
| 557 |
id: str,
|
| 558 |
*,
|
| 559 |
-
request_options:
|
| 560 |
) -> None:
|
| 561 |
"""Delete an organization membership
|
| 562 |
|
|
@@ -582,7 +585,7 @@ class AsyncOrganizationMembershipService:
|
|
| 582 |
self,
|
| 583 |
id: str,
|
| 584 |
*,
|
| 585 |
-
request_options:
|
| 586 |
) -> OrganizationMembership:
|
| 587 |
"""Deactivate an organization membership
|
| 588 |
|
|
@@ -619,7 +622,7 @@ class AsyncOrganizationMembershipService:
|
|
| 619 |
self,
|
| 620 |
id: str,
|
| 621 |
*,
|
| 622 |
-
request_options:
|
| 623 |
) -> UserOrganizationMembership:
|
| 624 |
"""Reactivate an organization membership
|
| 625 |
|
|
@@ -656,11 +659,11 @@ class AsyncOrganizationMembershipService:
|
|
| 656 |
self,
|
| 657 |
om_id: str,
|
| 658 |
*,
|
| 659 |
-
limit:
|
| 660 |
-
before:
|
| 661 |
-
after:
|
| 662 |
-
order:
|
| 663 |
-
request_options:
|
| 664 |
) -> AsyncPage[Group]:
|
| 665 |
"""List groups
|
| 666 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from dataclasses import dataclass
|
| 11 |
+
|
| 12 |
from workos.common.models.group import Group
|
|
|
|
| 13 |
from workos.common.models.pagination_order import PaginationOrder
|
| 14 |
+
|
| 15 |
from .._pagination import AsyncPage, SyncPage
|
| 16 |
+
from .._types import RequestOptions, enum_value
|
| 17 |
+
from .models import (
|
| 18 |
+
OrganizationMembership,
|
| 19 |
+
UserManagementOrganizationMembershipStatuses,
|
| 20 |
+
UserOrganizationMembership,
|
| 21 |
+
)
|
| 22 |
|
| 23 |
|
| 24 |
@dataclass
|
|
|
|
| 32 |
class RoleMultiple:
|
| 33 |
"""Identify role multiple."""
|
| 34 |
|
| 35 |
+
role_slugs: list[str]
|
| 36 |
|
| 37 |
|
| 38 |
class OrganizationMembershipService:
|
| 39 |
"""Organization Membership Service API resources."""
|
| 40 |
|
| 41 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 42 |
self._client = client
|
| 43 |
|
| 44 |
def list_organization_memberships(
|
| 45 |
self,
|
| 46 |
*,
|
| 47 |
+
limit: int | None = None,
|
| 48 |
+
before: str | None = None,
|
| 49 |
+
after: str | None = None,
|
| 50 |
+
order: PaginationOrder | str | None = "desc",
|
| 51 |
+
organization_id: str | None = None,
|
|
|
|
| 52 |
+
statuses: list[UserManagementOrganizationMembershipStatuses | str]
|
| 53 |
+
| None = None,
|
| 54 |
+
user_id: str | None = None,
|
| 55 |
+
request_options: RequestOptions | None = None,
|
| 56 |
) -> SyncPage[UserOrganizationMembership]:
|
| 57 |
"""List organization memberships
|
| 58 |
|
|
|
|
| 107 |
*,
|
| 108 |
user_id: str,
|
| 109 |
organization_id: str,
|
| 110 |
+
role: RoleSingle | RoleMultiple | None = None,
|
| 111 |
+
request_options: RequestOptions | None = None,
|
| 112 |
) -> OrganizationMembership:
|
| 113 |
"""Create an organization membership
|
| 114 |
|
|
|
|
| 133 |
RateLimitExceededError: If rate limited (429).
|
| 134 |
ServerError: If the server returns a 5xx error.
|
| 135 |
"""
|
| 136 |
+
body: dict[str, Any] = {
|
| 137 |
"user_id": user_id,
|
| 138 |
"organization_id": organization_id,
|
| 139 |
}
|
|
|
|
| 154 |
self,
|
| 155 |
id: str,
|
| 156 |
*,
|
| 157 |
+
request_options: RequestOptions | None = None,
|
| 158 |
) -> UserOrganizationMembership:
|
| 159 |
"""Get an organization membership
|
| 160 |
|
|
|
|
| 184 |
self,
|
| 185 |
id: str,
|
| 186 |
*,
|
| 187 |
+
role: RoleSingle | RoleMultiple | None = None,
|
| 188 |
+
request_options: RequestOptions | None = None,
|
| 189 |
) -> UserOrganizationMembership:
|
| 190 |
"""Update an organization membership
|
| 191 |
|
|
|
|
| 206 |
RateLimitExceededError: If rate limited (429).
|
| 207 |
ServerError: If the server returns a 5xx error.
|
| 208 |
"""
|
| 209 |
+
body: dict[str, Any] = {}
|
| 210 |
if role is not None:
|
| 211 |
if isinstance(role, RoleSingle):
|
| 212 |
body["role_slug"] = role.role_slug
|
|
|
|
| 224 |
self,
|
| 225 |
id: str,
|
| 226 |
*,
|
| 227 |
+
request_options: RequestOptions | None = None,
|
| 228 |
) -> None:
|
| 229 |
"""Delete an organization membership
|
| 230 |
|
|
|
|
| 250 |
self,
|
| 251 |
id: str,
|
| 252 |
*,
|
| 253 |
+
request_options: RequestOptions | None = None,
|
| 254 |
) -> OrganizationMembership:
|
| 255 |
"""Deactivate an organization membership
|
| 256 |
|
|
|
|
| 287 |
self,
|
| 288 |
id: str,
|
| 289 |
*,
|
| 290 |
+
request_options: RequestOptions | None = None,
|
| 291 |
) -> UserOrganizationMembership:
|
| 292 |
"""Reactivate an organization membership
|
| 293 |
|
|
|
|
| 324 |
self,
|
| 325 |
om_id: str,
|
| 326 |
*,
|
| 327 |
+
limit: int | None = None,
|
| 328 |
+
before: str | None = None,
|
| 329 |
+
after: str | None = None,
|
| 330 |
+
order: PaginationOrder | str | None = "desc",
|
| 331 |
+
request_options: RequestOptions | None = None,
|
| 332 |
) -> SyncPage[Group]:
|
| 333 |
"""List groups
|
| 334 |
|
|
|
|
| 373 |
class AsyncOrganizationMembershipService:
|
| 374 |
"""Organization Membership Service API resources (async)."""
|
| 375 |
|
| 376 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 377 |
self._client = client
|
| 378 |
|
| 379 |
async def list_organization_memberships(
|
| 380 |
self,
|
| 381 |
*,
|
| 382 |
+
limit: int | None = None,
|
| 383 |
+
before: str | None = None,
|
| 384 |
+
after: str | None = None,
|
| 385 |
+
order: PaginationOrder | str | None = "desc",
|
| 386 |
+
organization_id: str | None = None,
|
|
|
|
| 387 |
+
statuses: list[UserManagementOrganizationMembershipStatuses | str]
|
| 388 |
+
| None = None,
|
| 389 |
+
user_id: str | None = None,
|
| 390 |
+
request_options: RequestOptions | None = None,
|
| 391 |
) -> AsyncPage[UserOrganizationMembership]:
|
| 392 |
"""List organization memberships
|
| 393 |
|
|
|
|
| 442 |
*,
|
| 443 |
user_id: str,
|
| 444 |
organization_id: str,
|
| 445 |
+
role: RoleSingle | RoleMultiple | None = None,
|
| 446 |
+
request_options: RequestOptions | None = None,
|
| 447 |
) -> OrganizationMembership:
|
| 448 |
"""Create an organization membership
|
| 449 |
|
|
|
|
| 468 |
RateLimitExceededError: If rate limited (429).
|
| 469 |
ServerError: If the server returns a 5xx error.
|
| 470 |
"""
|
| 471 |
+
body: dict[str, Any] = {
|
| 472 |
"user_id": user_id,
|
| 473 |
"organization_id": organization_id,
|
| 474 |
}
|
|
|
|
| 489 |
self,
|
| 490 |
id: str,
|
| 491 |
*,
|
| 492 |
+
request_options: RequestOptions | None = None,
|
| 493 |
) -> UserOrganizationMembership:
|
| 494 |
"""Get an organization membership
|
| 495 |
|
|
|
|
| 519 |
self,
|
| 520 |
id: str,
|
| 521 |
*,
|
| 522 |
+
role: RoleSingle | RoleMultiple | None = None,
|
| 523 |
+
request_options: RequestOptions | None = None,
|
| 524 |
) -> UserOrganizationMembership:
|
| 525 |
"""Update an organization membership
|
| 526 |
|
|
|
|
| 541 |
RateLimitExceededError: If rate limited (429).
|
| 542 |
ServerError: If the server returns a 5xx error.
|
| 543 |
"""
|
| 544 |
+
body: dict[str, Any] = {}
|
| 545 |
if role is not None:
|
| 546 |
if isinstance(role, RoleSingle):
|
| 547 |
body["role_slug"] = role.role_slug
|
|
|
|
| 559 |
self,
|
| 560 |
id: str,
|
| 561 |
*,
|
| 562 |
+
request_options: RequestOptions | None = None,
|
| 563 |
) -> None:
|
| 564 |
"""Delete an organization membership
|
| 565 |
|
|
|
|
| 585 |
self,
|
| 586 |
id: str,
|
| 587 |
*,
|
| 588 |
+
request_options: RequestOptions | None = None,
|
| 589 |
) -> OrganizationMembership:
|
| 590 |
"""Deactivate an organization membership
|
| 591 |
|
|
|
|
| 622 |
self,
|
| 623 |
id: str,
|
| 624 |
*,
|
| 625 |
+
request_options: RequestOptions | None = None,
|
| 626 |
) -> UserOrganizationMembership:
|
| 627 |
"""Reactivate an organization membership
|
| 628 |
|
|
|
|
| 659 |
self,
|
| 660 |
om_id: str,
|
| 661 |
*,
|
| 662 |
+
limit: int | None = None,
|
| 663 |
+
before: str | None = None,
|
| 664 |
+
after: str | None = None,
|
| 665 |
+
order: PaginationOrder | str | None = "desc",
|
| 666 |
+
request_options: RequestOptions | None = None,
|
| 667 |
) -> AsyncPage[Group]:
|
| 668 |
"""List groups
|
| 669 |
|
python/src/workos/organization_membership/models/create_user_organization_membership.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,13 +16,13 @@ class CreateUserOrganizationMembership:
|
|
| 15 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 16 |
organization_id: str
|
| 17 |
"""The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to."""
|
| 18 |
-
role_slug:
|
| 19 |
"""A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`."""
|
| 20 |
-
role_slugs:
|
| 21 |
"""An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class CreateUserOrganizationMembership:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("CreateUserOrganizationMembership", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["user_id"] = self.user_id
|
| 40 |
result["organization_id"] = self.organization_id
|
| 41 |
if self.role_slug is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The ID of the [user](https://workos.com/docs/reference/authkit/user)."""
|
| 17 |
organization_id: str
|
| 18 |
"""The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to."""
|
| 19 |
+
role_slug: str | None = None
|
| 20 |
"""A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`."""
|
| 21 |
+
role_slugs: list[str] | None = None
|
| 22 |
"""An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateUserOrganizationMembership:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateUserOrganizationMembership", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["user_id"] = self.user_id
|
| 41 |
result["organization_id"] = self.organization_id
|
| 42 |
if self.role_slug is not None:
|
python/src/workos/organization_membership/models/organization_membership.py|
@@ -5,16 +5,14 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import cast
|
| 9 |
-
from typing import Any,
|
| 10 |
-
from workos._types import _raise_deserialize_error
|
| 11 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 12 |
|
| 13 |
-
from workos.
|
| 14 |
-
from workos.common.models.user import User
|
| 15 |
from workos.common.models.organization_membership_status import (
|
| 16 |
OrganizationMembershipStatus,
|
| 17 |
)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
@dataclass(slots=True)
|
|
@@ -29,7 +27,7 @@ class OrganizationMembership:
|
|
| 29 |
"""The ID of the user."""
|
| 30 |
organization_id: str
|
| 31 |
"""The ID of the organization which the user belongs to."""
|
| 32 |
-
status:
|
| 33 |
"""The status of the organization membership. One of `active`, `inactive`, or `pending`."""
|
| 34 |
directory_managed: bool
|
| 35 |
"""Whether this organization membership is managed by a directory sync connection."""
|
|
@@ -37,19 +35,19 @@ class OrganizationMembership:
|
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
updated_at: datetime
|
| 39 |
"""An ISO 8601 timestamp."""
|
| 40 |
-
role:
|
| 41 |
"""The primary role assigned to the user within the organization."""
|
| 42 |
-
roles:
|
| 43 |
"""The list of roles assigned to the user within the organization."""
|
| 44 |
-
user:
|
| 45 |
"""The user that belongs to the organization through this membership."""
|
| 46 |
-
organization_name:
|
| 47 |
"""The name of the organization which the user belongs to."""
|
| 48 |
-
custom_attributes:
|
| 49 |
"""An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked."""
|
| 50 |
|
| 51 |
@classmethod
|
| 52 |
-
def from_dict(cls, data:
|
| 53 |
"""Deserialize from a dictionary."""
|
| 54 |
try:
|
| 55 |
return cls(
|
|
@@ -61,21 +59,21 @@ class OrganizationMembership:
|
|
| 61 |
directory_managed=data["directory_managed"],
|
| 62 |
created_at=_parse_datetime(data["created_at"]),
|
| 63 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 64 |
-
role=SlimRole.from_dict(cast(
|
| 65 |
roles=[
|
| 66 |
-
SlimRole.from_dict(cast(
|
| 67 |
for item in cast(list[Any], data["roles"])
|
| 68 |
],
|
| 69 |
-
user=User.from_dict(cast(
|
| 70 |
organization_name=data.get("organization_name"),
|
| 71 |
custom_attributes=data.get("custom_attributes"),
|
| 72 |
)
|
| 73 |
except (KeyError, ValueError) as e:
|
| 74 |
_raise_deserialize_error("OrganizationMembership", e)
|
| 75 |
|
| 76 |
-
def to_dict(self) ->
|
| 77 |
"""Serialize to a dictionary."""
|
| 78 |
-
result:
|
| 79 |
result["object"] = self.object
|
| 80 |
result["id"] = self.id
|
| 81 |
result["user_id"] = self.user_id
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
|
|
|
| 11 |
from workos.common.models.organization_membership_status import (
|
| 12 |
OrganizationMembershipStatus,
|
| 13 |
)
|
| 14 |
+
from workos.common.models.slim_role import SlimRole
|
| 15 |
+
from workos.common.models.user import User
|
| 16 |
|
| 17 |
|
| 18 |
@dataclass(slots=True)
|
|
|
|
| 27 |
"""The ID of the user."""
|
| 28 |
organization_id: str
|
| 29 |
"""The ID of the organization which the user belongs to."""
|
| 30 |
+
status: OrganizationMembershipStatus
|
| 31 |
"""The status of the organization membership. One of `active`, `inactive`, or `pending`."""
|
| 32 |
directory_managed: bool
|
| 33 |
"""Whether this organization membership is managed by a directory sync connection."""
|
|
|
|
| 35 |
"""An ISO 8601 timestamp."""
|
| 36 |
updated_at: datetime
|
| 37 |
"""An ISO 8601 timestamp."""
|
| 38 |
+
role: SlimRole
|
| 39 |
"""The primary role assigned to the user within the organization."""
|
| 40 |
+
roles: list[SlimRole]
|
| 41 |
"""The list of roles assigned to the user within the organization."""
|
| 42 |
+
user: User
|
| 43 |
"""The user that belongs to the organization through this membership."""
|
| 44 |
+
organization_name: str | None = None
|
| 45 |
"""The name of the organization which the user belongs to."""
|
| 46 |
+
custom_attributes: dict[str, Any] | None = None
|
| 47 |
"""An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked."""
|
| 48 |
|
| 49 |
@classmethod
|
| 50 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationMembership:
|
| 51 |
"""Deserialize from a dictionary."""
|
| 52 |
try:
|
| 53 |
return cls(
|
|
|
|
| 59 |
directory_managed=data["directory_managed"],
|
| 60 |
created_at=_parse_datetime(data["created_at"]),
|
| 61 |
updated_at=_parse_datetime(data["updated_at"]),
|
| 62 |
+
role=SlimRole.from_dict(cast(dict[str, Any], data["role"])),
|
| 63 |
roles=[
|
| 64 |
+
SlimRole.from_dict(cast(dict[str, Any], item))
|
| 65 |
for item in cast(list[Any], data["roles"])
|
| 66 |
],
|
| 67 |
+
user=User.from_dict(cast(dict[str, Any], data["user"])),
|
| 68 |
organization_name=data.get("organization_name"),
|
| 69 |
custom_attributes=data.get("custom_attributes"),
|
| 70 |
)
|
| 71 |
except (KeyError, ValueError) as e:
|
| 72 |
_raise_deserialize_error("OrganizationMembership", e)
|
| 73 |
|
| 74 |
+
def to_dict(self) -> dict[str, Any]:
|
| 75 |
"""Serialize to a dictionary."""
|
| 76 |
+
result: dict[str, Any] = {}
|
| 77 |
result["object"] = self.object
|
| 78 |
result["id"] = self.id
|
| 79 |
result["user_id"] = self.user_id
|
python/src/workos/organization_membership/models/update_user_organization_membership.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,13 +12,13 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class UpdateUserOrganizationMembership:
|
| 12 |
"""Update User Organization Membership model."""
|
| 13 |
|
| 14 |
-
role_slug:
|
| 15 |
"""A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`."""
|
| 16 |
-
role_slugs:
|
| 17 |
"""An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class UpdateUserOrganizationMembership:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("UpdateUserOrganizationMembership", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
if self.role_slug is not None:
|
| 34 |
result["role_slug"] = self.role_slug
|
| 35 |
if self.role_slugs is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class UpdateUserOrganizationMembership:
|
| 13 |
"""Update User Organization Membership model."""
|
| 14 |
|
| 15 |
+
role_slug: str | None = None
|
| 16 |
"""A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`."""
|
| 17 |
+
role_slugs: list[str] | None = None
|
| 18 |
"""An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateUserOrganizationMembership:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("UpdateUserOrganizationMembership", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
if self.role_slug is not None:
|
| 35 |
result["role_slug"] = self.role_slug
|
| 36 |
if self.role_slugs is not None:
|
python/src/workos/organizations/_resource.py|
@@ -2,38 +2,39 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
-
from .._types import
|
| 11 |
from .models import (
|
| 12 |
AuditLogConfiguration,
|
| 13 |
Organization,
|
| 14 |
OrganizationAuthorizedConnectApplicationListData,
|
| 15 |
OrganizationDomainData,
|
| 16 |
)
|
| 17 |
-
from workos.common.models.pagination_order import PaginationOrder
|
| 18 |
-
from .._pagination import AsyncPage, SyncPage
|
| 19 |
|
| 20 |
|
| 21 |
class Organizations:
|
| 22 |
"""Organizations API resources."""
|
| 23 |
|
| 24 |
-
def __init__(self, client:
|
| 25 |
self._client = client
|
| 26 |
|
| 27 |
def list_organizations(
|
| 28 |
self,
|
| 29 |
*,
|
| 30 |
-
limit:
|
| 31 |
-
before:
|
| 32 |
-
after:
|
| 33 |
-
order:
|
| 34 |
-
domains:
|
| 35 |
-
search:
|
| 36 |
-
request_options:
|
| 37 |
) -> SyncPage[Organization]:
|
| 38 |
"""List Organizations
|
| 39 |
|
|
@@ -83,12 +84,12 @@ class Organizations:
|
|
| 83 |
self,
|
| 84 |
*,
|
| 85 |
name: str,
|
| 86 |
-
allow_profiles_outside_organization:
|
| 87 |
-
domains:
|
| 88 |
-
domain_data:
|
| 89 |
-
metadata:
|
| 90 |
-
external_id:
|
| 91 |
-
request_options:
|
| 92 |
) -> Organization:
|
| 93 |
"""Create an Organization
|
| 94 |
|
|
@@ -114,7 +115,7 @@ class Organizations:
|
|
| 114 |
RateLimitExceededError: If rate limited (429).
|
| 115 |
ServerError: If the server returns a 5xx error.
|
| 116 |
"""
|
| 117 |
-
body:
|
| 118 |
k: v
|
| 119 |
for k, v in {
|
| 120 |
"name": name,
|
|
@@ -142,7 +143,7 @@ class Organizations:
|
|
| 142 |
self,
|
| 143 |
external_id: str,
|
| 144 |
*,
|
| 145 |
-
request_options:
|
| 146 |
) -> Organization:
|
| 147 |
"""Get an Organization by External ID
|
| 148 |
|
|
@@ -172,7 +173,7 @@ class Organizations:
|
|
| 172 |
self,
|
| 173 |
id: str,
|
| 174 |
*,
|
| 175 |
-
request_options:
|
| 176 |
) -> Organization:
|
| 177 |
"""Get an Organization
|
| 178 |
|
|
@@ -202,14 +203,14 @@ class Organizations:
|
|
| 202 |
self,
|
| 203 |
id: str,
|
| 204 |
*,
|
| 205 |
-
name:
|
| 206 |
-
allow_profiles_outside_organization:
|
| 207 |
-
domains:
|
| 208 |
-
domain_data:
|
| 209 |
-
stripe_customer_id:
|
| 210 |
-
metadata:
|
| 211 |
-
external_id:
|
| 212 |
-
request_options:
|
| 213 |
) -> Organization:
|
| 214 |
"""Update an Organization
|
| 215 |
|
|
@@ -239,7 +240,7 @@ class Organizations:
|
|
| 239 |
RateLimitExceededError: If rate limited (429).
|
| 240 |
ServerError: If the server returns a 5xx error.
|
| 241 |
"""
|
| 242 |
-
body:
|
| 243 |
k: v
|
| 244 |
for k, v in {
|
| 245 |
"name": name,
|
|
@@ -268,7 +269,7 @@ class Organizations:
|
|
| 268 |
self,
|
| 269 |
id: str,
|
| 270 |
*,
|
| 271 |
-
request_options:
|
| 272 |
) -> None:
|
| 273 |
"""Delete an Organization
|
| 274 |
|
|
@@ -294,7 +295,7 @@ class Organizations:
|
|
| 294 |
self,
|
| 295 |
id: str,
|
| 296 |
*,
|
| 297 |
-
request_options:
|
| 298 |
) -> AuditLogConfiguration:
|
| 299 |
"""Get Audit Log Configuration
|
| 300 |
|
|
@@ -324,11 +325,11 @@ class Organizations:
|
|
| 324 |
self,
|
| 325 |
organization_id: str,
|
| 326 |
*,
|
| 327 |
-
limit:
|
| 328 |
-
before:
|
| 329 |
-
after:
|
| 330 |
-
order:
|
| 331 |
-
request_options:
|
| 332 |
) -> SyncPage[OrganizationAuthorizedConnectApplicationListData]:
|
| 333 |
"""List authorized applications
|
| 334 |
|
|
@@ -374,19 +375,19 @@ class Organizations:
|
|
| 374 |
class AsyncOrganizations:
|
| 375 |
"""Organizations API resources (async)."""
|
| 376 |
|
| 377 |
-
def __init__(self, client:
|
| 378 |
self._client = client
|
| 379 |
|
| 380 |
async def list_organizations(
|
| 381 |
self,
|
| 382 |
*,
|
| 383 |
-
limit:
|
| 384 |
-
before:
|
| 385 |
-
after:
|
| 386 |
-
order:
|
| 387 |
-
domains:
|
| 388 |
-
search:
|
| 389 |
-
request_options:
|
| 390 |
) -> AsyncPage[Organization]:
|
| 391 |
"""List Organizations
|
| 392 |
|
|
@@ -436,12 +437,12 @@ class AsyncOrganizations:
|
|
| 436 |
self,
|
| 437 |
*,
|
| 438 |
name: str,
|
| 439 |
-
allow_profiles_outside_organization:
|
| 440 |
-
domains:
|
| 441 |
-
domain_data:
|
| 442 |
-
metadata:
|
| 443 |
-
external_id:
|
| 444 |
-
request_options:
|
| 445 |
) -> Organization:
|
| 446 |
"""Create an Organization
|
| 447 |
|
|
@@ -467,7 +468,7 @@ class AsyncOrganizations:
|
|
| 467 |
RateLimitExceededError: If rate limited (429).
|
| 468 |
ServerError: If the server returns a 5xx error.
|
| 469 |
"""
|
| 470 |
-
body:
|
| 471 |
k: v
|
| 472 |
for k, v in {
|
| 473 |
"name": name,
|
|
@@ -495,7 +496,7 @@ class AsyncOrganizations:
|
|
| 495 |
self,
|
| 496 |
external_id: str,
|
| 497 |
*,
|
| 498 |
-
request_options:
|
| 499 |
) -> Organization:
|
| 500 |
"""Get an Organization by External ID
|
| 501 |
|
|
@@ -525,7 +526,7 @@ class AsyncOrganizations:
|
|
| 525 |
self,
|
| 526 |
id: str,
|
| 527 |
*,
|
| 528 |
-
request_options:
|
| 529 |
) -> Organization:
|
| 530 |
"""Get an Organization
|
| 531 |
|
|
@@ -555,14 +556,14 @@ class AsyncOrganizations:
|
|
| 555 |
self,
|
| 556 |
id: str,
|
| 557 |
*,
|
| 558 |
-
name:
|
| 559 |
-
allow_profiles_outside_organization:
|
| 560 |
-
domains:
|
| 561 |
-
domain_data:
|
| 562 |
-
stripe_customer_id:
|
| 563 |
-
metadata:
|
| 564 |
-
external_id:
|
| 565 |
-
request_options:
|
| 566 |
) -> Organization:
|
| 567 |
"""Update an Organization
|
| 568 |
|
|
@@ -592,7 +593,7 @@ class AsyncOrganizations:
|
|
| 592 |
RateLimitExceededError: If rate limited (429).
|
| 593 |
ServerError: If the server returns a 5xx error.
|
| 594 |
"""
|
| 595 |
-
body:
|
| 596 |
k: v
|
| 597 |
for k, v in {
|
| 598 |
"name": name,
|
|
@@ -621,7 +622,7 @@ class AsyncOrganizations:
|
|
| 621 |
self,
|
| 622 |
id: str,
|
| 623 |
*,
|
| 624 |
-
request_options:
|
| 625 |
) -> None:
|
| 626 |
"""Delete an Organization
|
| 627 |
|
|
@@ -647,7 +648,7 @@ class AsyncOrganizations:
|
|
| 647 |
self,
|
| 648 |
id: str,
|
| 649 |
*,
|
| 650 |
-
request_options:
|
| 651 |
) -> AuditLogConfiguration:
|
| 652 |
"""Get Audit Log Configuration
|
| 653 |
|
|
@@ -677,11 +678,11 @@ class AsyncOrganizations:
|
|
| 677 |
self,
|
| 678 |
organization_id: str,
|
| 679 |
*,
|
| 680 |
-
limit:
|
| 681 |
-
before:
|
| 682 |
-
after:
|
| 683 |
-
order:
|
| 684 |
-
request_options:
|
| 685 |
) -> AsyncPage[OrganizationAuthorizedConnectApplicationListData]:
|
| 686 |
"""List authorized applications
|
| 687 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.pagination_order import PaginationOrder
|
| 11 |
+
|
| 12 |
+
from .._pagination import AsyncPage, SyncPage
|
| 13 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 14 |
from .models import (
|
| 15 |
AuditLogConfiguration,
|
| 16 |
Organization,
|
| 17 |
OrganizationAuthorizedConnectApplicationListData,
|
| 18 |
OrganizationDomainData,
|
| 19 |
)
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
class Organizations:
|
| 23 |
"""Organizations API resources."""
|
| 24 |
|
| 25 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 26 |
self._client = client
|
| 27 |
|
| 28 |
def list_organizations(
|
| 29 |
self,
|
| 30 |
*,
|
| 31 |
+
limit: int | None = None,
|
| 32 |
+
before: str | None = None,
|
| 33 |
+
after: str | None = None,
|
| 34 |
+
order: PaginationOrder | str | None = "desc",
|
| 35 |
+
domains: list[str] | None = None,
|
| 36 |
+
search: str | None = None,
|
| 37 |
+
request_options: RequestOptions | None = None,
|
| 38 |
) -> SyncPage[Organization]:
|
| 39 |
"""List Organizations
|
| 40 |
|
|
|
|
| 84 |
self,
|
| 85 |
*,
|
| 86 |
name: str,
|
| 87 |
+
allow_profiles_outside_organization: bool | None = None,
|
| 88 |
+
domains: list[str] | None = None,
|
| 89 |
+
domain_data: list[OrganizationDomainData] | None = None,
|
| 90 |
+
metadata: dict[str, str] | None | NotGiven = NOT_GIVEN,
|
| 91 |
+
external_id: str | None | NotGiven = NOT_GIVEN,
|
| 92 |
+
request_options: RequestOptions | None = None,
|
| 93 |
) -> Organization:
|
| 94 |
"""Create an Organization
|
| 95 |
|
|
|
|
| 115 |
RateLimitExceededError: If rate limited (429).
|
| 116 |
ServerError: If the server returns a 5xx error.
|
| 117 |
"""
|
| 118 |
+
body: dict[str, Any] = {
|
| 119 |
k: v
|
| 120 |
for k, v in {
|
| 121 |
"name": name,
|
|
|
|
| 143 |
self,
|
| 144 |
external_id: str,
|
| 145 |
*,
|
| 146 |
+
request_options: RequestOptions | None = None,
|
| 147 |
) -> Organization:
|
| 148 |
"""Get an Organization by External ID
|
| 149 |
|
|
|
|
| 173 |
self,
|
| 174 |
id: str,
|
| 175 |
*,
|
| 176 |
+
request_options: RequestOptions | None = None,
|
| 177 |
) -> Organization:
|
| 178 |
"""Get an Organization
|
| 179 |
|
|
|
|
| 203 |
self,
|
| 204 |
id: str,
|
| 205 |
*,
|
| 206 |
+
name: str | None = None,
|
| 207 |
+
allow_profiles_outside_organization: bool | None = None,
|
| 208 |
+
domains: list[str] | None = None,
|
| 209 |
+
domain_data: list[OrganizationDomainData] | None = None,
|
| 210 |
+
stripe_customer_id: str | None = None,
|
| 211 |
+
metadata: dict[str, str] | None | NotGiven = NOT_GIVEN,
|
| 212 |
+
external_id: str | None | NotGiven = NOT_GIVEN,
|
| 213 |
+
request_options: RequestOptions | None = None,
|
| 214 |
) -> Organization:
|
| 215 |
"""Update an Organization
|
| 216 |
|
|
|
|
| 240 |
RateLimitExceededError: If rate limited (429).
|
| 241 |
ServerError: If the server returns a 5xx error.
|
| 242 |
"""
|
| 243 |
+
body: dict[str, Any] = {
|
| 244 |
k: v
|
| 245 |
for k, v in {
|
| 246 |
"name": name,
|
|
|
|
| 269 |
self,
|
| 270 |
id: str,
|
| 271 |
*,
|
| 272 |
+
request_options: RequestOptions | None = None,
|
| 273 |
) -> None:
|
| 274 |
"""Delete an Organization
|
| 275 |
|
|
|
|
| 295 |
self,
|
| 296 |
id: str,
|
| 297 |
*,
|
| 298 |
+
request_options: RequestOptions | None = None,
|
| 299 |
) -> AuditLogConfiguration:
|
| 300 |
"""Get Audit Log Configuration
|
| 301 |
|
|
|
|
| 325 |
self,
|
| 326 |
organization_id: str,
|
| 327 |
*,
|
| 328 |
+
limit: int | None = None,
|
| 329 |
+
before: str | None = None,
|
| 330 |
+
after: str | None = None,
|
| 331 |
+
order: PaginationOrder | str | None = "desc",
|
| 332 |
+
request_options: RequestOptions | None = None,
|
| 333 |
) -> SyncPage[OrganizationAuthorizedConnectApplicationListData]:
|
| 334 |
"""List authorized applications
|
| 335 |
|
|
|
|
| 375 |
class AsyncOrganizations:
|
| 376 |
"""Organizations API resources (async)."""
|
| 377 |
|
| 378 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 379 |
self._client = client
|
| 380 |
|
| 381 |
async def list_organizations(
|
| 382 |
self,
|
| 383 |
*,
|
| 384 |
+
limit: int | None = None,
|
| 385 |
+
before: str | None = None,
|
| 386 |
+
after: str | None = None,
|
| 387 |
+
order: PaginationOrder | str | None = "desc",
|
| 388 |
+
domains: list[str] | None = None,
|
| 389 |
+
search: str | None = None,
|
| 390 |
+
request_options: RequestOptions | None = None,
|
| 391 |
) -> AsyncPage[Organization]:
|
| 392 |
"""List Organizations
|
| 393 |
|
|
|
|
| 437 |
self,
|
| 438 |
*,
|
| 439 |
name: str,
|
| 440 |
+
allow_profiles_outside_organization: bool | None = None,
|
| 441 |
+
domains: list[str] | None = None,
|
| 442 |
+
domain_data: list[OrganizationDomainData] | None = None,
|
| 443 |
+
metadata: dict[str, str] | None | NotGiven = NOT_GIVEN,
|
| 444 |
+
external_id: str | None | NotGiven = NOT_GIVEN,
|
| 445 |
+
request_options: RequestOptions | None = None,
|
| 446 |
) -> Organization:
|
| 447 |
"""Create an Organization
|
| 448 |
|
|
|
|
| 468 |
RateLimitExceededError: If rate limited (429).
|
| 469 |
ServerError: If the server returns a 5xx error.
|
| 470 |
"""
|
| 471 |
+
body: dict[str, Any] = {
|
| 472 |
k: v
|
| 473 |
for k, v in {
|
| 474 |
"name": name,
|
|
|
|
| 496 |
self,
|
| 497 |
external_id: str,
|
| 498 |
*,
|
| 499 |
+
request_options: RequestOptions | None = None,
|
| 500 |
) -> Organization:
|
| 501 |
"""Get an Organization by External ID
|
| 502 |
|
|
|
|
| 526 |
self,
|
| 527 |
id: str,
|
| 528 |
*,
|
| 529 |
+
request_options: RequestOptions | None = None,
|
| 530 |
) -> Organization:
|
| 531 |
"""Get an Organization
|
| 532 |
|
|
|
|
| 556 |
self,
|
| 557 |
id: str,
|
| 558 |
*,
|
| 559 |
+
name: str | None = None,
|
| 560 |
+
allow_profiles_outside_organization: bool | None = None,
|
| 561 |
+
domains: list[str] | None = None,
|
| 562 |
+
domain_data: list[OrganizationDomainData] | None = None,
|
| 563 |
+
stripe_customer_id: str | None = None,
|
| 564 |
+
metadata: dict[str, str] | None | NotGiven = NOT_GIVEN,
|
| 565 |
+
external_id: str | None | NotGiven = NOT_GIVEN,
|
| 566 |
+
request_options: RequestOptions | None = None,
|
| 567 |
) -> Organization:
|
| 568 |
"""Update an Organization
|
| 569 |
|
|
|
|
| 593 |
RateLimitExceededError: If rate limited (429).
|
| 594 |
ServerError: If the server returns a 5xx error.
|
| 595 |
"""
|
| 596 |
+
body: dict[str, Any] = {
|
| 597 |
k: v
|
| 598 |
for k, v in {
|
| 599 |
"name": name,
|
|
|
|
| 622 |
self,
|
| 623 |
id: str,
|
| 624 |
*,
|
| 625 |
+
request_options: RequestOptions | None = None,
|
| 626 |
) -> None:
|
| 627 |
"""Delete an Organization
|
| 628 |
|
|
|
|
| 648 |
self,
|
| 649 |
id: str,
|
| 650 |
*,
|
| 651 |
+
request_options: RequestOptions | None = None,
|
| 652 |
) -> AuditLogConfiguration:
|
| 653 |
"""Get Audit Log Configuration
|
| 654 |
|
|
|
|
| 678 |
self,
|
| 679 |
organization_id: str,
|
| 680 |
*,
|
| 681 |
+
limit: int | None = None,
|
| 682 |
+
before: str | None = None,
|
| 683 |
+
after: str | None = None,
|
| 684 |
+
order: PaginationOrder | str | None = "desc",
|
| 685 |
+
request_options: RequestOptions | None = None,
|
| 686 |
) -> AsyncPage[OrganizationAuthorizedConnectApplicationListData]:
|
| 687 |
"""List authorized applications
|
| 688 |
|
python/src/workos/organizations/models/audit_log_configuration.py|
@@ -4,15 +4,15 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any, Dict, Optional
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
|
| 11 |
-
from .
|
| 12 |
from workos.common.models.audit_log_configuration_state import (
|
| 13 |
AuditLogConfigurationState,
|
| 14 |
)
|
| 15 |
|
|
|
|
|
|
|
| 16 |
|
| 17 |
@dataclass(slots=True)
|
| 18 |
class AuditLogConfiguration:
|
|
@@ -22,13 +22,13 @@ class AuditLogConfiguration:
|
|
| 22 |
"""Unique identifier of the Organization."""
|
| 23 |
retention_period_in_days: int
|
| 24 |
"""The number of days Audit Log events will be retained before being permanently deleted."""
|
| 25 |
-
state:
|
| 26 |
"""The current state of the audit log configuration for the organization."""
|
| 27 |
-
log_stream:
|
| 28 |
"""The Audit Log Stream currently configured for the organization, if any."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -36,7 +36,7 @@ class AuditLogConfiguration:
|
|
| 36 |
retention_period_in_days=data["retention_period_in_days"],
|
| 37 |
state=AuditLogConfigurationState(data["state"]),
|
| 38 |
log_stream=AuditLogConfigurationLogStream.from_dict(
|
| 39 |
-
cast(
|
| 40 |
)
|
| 41 |
if (_v_log_stream := data.get("log_stream")) is not None
|
| 42 |
else None,
|
|
@@ -44,9 +44,9 @@ class AuditLogConfiguration:
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("AuditLogConfiguration", e)
|
| 46 |
|
| 47 |
-
def to_dict(self) ->
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
-
result:
|
| 50 |
result["organization_id"] = self.organization_id
|
| 51 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 52 |
result["state"] = (
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.audit_log_configuration_state import (
|
| 11 |
AuditLogConfigurationState,
|
| 12 |
)
|
| 13 |
|
| 14 |
+
from .audit_log_configuration_log_stream import AuditLogConfigurationLogStream
|
| 15 |
+
|
| 16 |
|
| 17 |
@dataclass(slots=True)
|
| 18 |
class AuditLogConfiguration:
|
|
|
|
| 22 |
"""Unique identifier of the Organization."""
|
| 23 |
retention_period_in_days: int
|
| 24 |
"""The number of days Audit Log events will be retained before being permanently deleted."""
|
| 25 |
+
state: AuditLogConfigurationState
|
| 26 |
"""The current state of the audit log configuration for the organization."""
|
| 27 |
+
log_stream: AuditLogConfigurationLogStream | None = None
|
| 28 |
"""The Audit Log Stream currently configured for the organization, if any."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogConfiguration:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 36 |
retention_period_in_days=data["retention_period_in_days"],
|
| 37 |
state=AuditLogConfigurationState(data["state"]),
|
| 38 |
log_stream=AuditLogConfigurationLogStream.from_dict(
|
| 39 |
+
cast(dict[str, Any], _v_log_stream)
|
| 40 |
)
|
| 41 |
if (_v_log_stream := data.get("log_stream")) is not None
|
| 42 |
else None,
|
|
|
|
| 44 |
except (KeyError, ValueError) as e:
|
| 45 |
_raise_deserialize_error("AuditLogConfiguration", e)
|
| 46 |
|
| 47 |
+
def to_dict(self) -> dict[str, Any]:
|
| 48 |
"""Serialize to a dictionary."""
|
| 49 |
+
result: dict[str, Any] = {}
|
| 50 |
result["organization_id"] = self.organization_id
|
| 51 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 52 |
result["state"] = (
|
python/src/workos/organizations/models/audit_log_configuration_log_stream.py|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
from workos.common.models.audit_log_configuration_log_stream_state import (
|
| 12 |
AuditLogConfigurationLogStreamState,
|
| 13 |
)
|
|
@@ -22,17 +22,17 @@ class AuditLogConfigurationLogStream:
|
|
| 22 |
|
| 23 |
id: str
|
| 24 |
"""Unique identifier of the Audit Log Stream."""
|
| 25 |
-
type:
|
| 26 |
"""The type of the Audit Log Stream destination."""
|
| 27 |
-
state:
|
| 28 |
"""The current state of the Audit Log Stream."""
|
| 29 |
-
last_synced_at:
|
| 30 |
"""ISO-8601 timestamp of when the last event was successfully synced, or null if no events have been synced."""
|
| 31 |
created_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
-
def from_dict(cls, data:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -45,9 +45,9 @@ class AuditLogConfigurationLogStream:
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuditLogConfigurationLogStream", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
result["id"] = self.id
|
| 52 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 53 |
result["state"] = (
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.audit_log_configuration_log_stream_state import (
|
| 12 |
AuditLogConfigurationLogStreamState,
|
| 13 |
)
|
|
|
|
| 22 |
|
| 23 |
id: str
|
| 24 |
"""Unique identifier of the Audit Log Stream."""
|
| 25 |
+
type: AuditLogConfigurationLogStreamType
|
| 26 |
"""The type of the Audit Log Stream destination."""
|
| 27 |
+
state: AuditLogConfigurationLogStreamState
|
| 28 |
"""The current state of the Audit Log Stream."""
|
| 29 |
+
last_synced_at: str | None
|
| 30 |
"""ISO-8601 timestamp of when the last event was successfully synced, or null if no events have been synced."""
|
| 31 |
created_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogConfigurationLogStream:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("AuditLogConfigurationLogStream", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
result["id"] = self.id
|
| 52 |
result["type"] = self.type.value if isinstance(self.type, Enum) else self.type
|
| 53 |
result["state"] = (
|
python/src/workos/organizations/models/audit_logs_retention.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class AuditLogsRetention:
|
| 12 |
"""Audit Logs Retention model."""
|
| 13 |
|
| 14 |
-
retention_period_in_days:
|
| 15 |
"""The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,9 +25,9 @@ class AuditLogsRetention:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("AuditLogsRetention", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
if self.retention_period_in_days is not None:
|
| 31 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 32 |
else:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class AuditLogsRetention:
|
| 13 |
"""Audit Logs Retention model."""
|
| 14 |
|
| 15 |
+
retention_period_in_days: int | None
|
| 16 |
"""The number of days Audit Log events will be retained before being permanently deleted. Valid values are 30 and 365."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> AuditLogsRetention:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("AuditLogsRetention", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
if self.retention_period_in_days is not None:
|
| 32 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 33 |
else:
|
python/src/workos/organizations/models/organization.py|
@@ -4,11 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import cast
|
| 8 |
-
from typing import Any,
|
| 9 |
-
from workos._types import _raise_deserialize_error
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
|
|
|
|
| 12 |
from workos.common.models.organization_domain import OrganizationDomain
|
| 13 |
|
| 14 |
|
|
@@ -22,25 +20,25 @@ class Organization:
|
|
| 22 |
"""Unique identifier of the Organization."""
|
| 23 |
name: str
|
| 24 |
"""A descriptive name for the Organization. This field does not need to be unique."""
|
| 25 |
-
domains:
|
| 26 |
"""List of Organization Domains."""
|
| 27 |
-
metadata:
|
| 28 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 29 |
-
external_id:
|
| 30 |
"""The external ID of the Organization."""
|
| 31 |
created_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
updated_at: datetime
|
| 34 |
"""An ISO 8601 timestamp."""
|
| 35 |
-
stripe_customer_id:
|
| 36 |
"""The Stripe customer ID of the Organization."""
|
| 37 |
-
allow_profiles_outside_organization:
|
| 38 |
"""Whether the Organization allows profiles outside of its managed domains.
|
| 39 |
|
| 40 |
.. deprecated:: This field is deprecated."""
|
| 41 |
|
| 42 |
@classmethod
|
| 43 |
-
def from_dict(cls, data:
|
| 44 |
"""Deserialize from a dictionary."""
|
| 45 |
try:
|
| 46 |
return cls(
|
|
@@ -48,7 +46,7 @@ class Organization:
|
|
| 48 |
id=data["id"],
|
| 49 |
name=data["name"],
|
| 50 |
domains=[
|
| 51 |
-
OrganizationDomain.from_dict(cast(
|
| 52 |
for item in cast(list[Any], data["domains"])
|
| 53 |
],
|
| 54 |
metadata=data["metadata"],
|
|
@@ -63,9 +61,9 @@ class Organization:
|
|
| 63 |
except (KeyError, ValueError) as e:
|
| 64 |
_raise_deserialize_error("Organization", e)
|
| 65 |
|
| 66 |
-
def to_dict(self) ->
|
| 67 |
"""Serialize to a dictionary."""
|
| 68 |
-
result:
|
| 69 |
result["object"] = self.object
|
| 70 |
result["id"] = self.id
|
| 71 |
result["name"] = self.name
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
|
|
|
| 7 |
+
from typing import Any, Literal, cast
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
from workos.common.models.organization_domain import OrganizationDomain
|
| 11 |
|
| 12 |
|
|
|
|
| 20 |
"""Unique identifier of the Organization."""
|
| 21 |
name: str
|
| 22 |
"""A descriptive name for the Organization. This field does not need to be unique."""
|
| 23 |
+
domains: list[OrganizationDomain]
|
| 24 |
"""List of Organization Domains."""
|
| 25 |
+
metadata: dict[str, str]
|
| 26 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 27 |
+
external_id: str | None
|
| 28 |
"""The external ID of the Organization."""
|
| 29 |
created_at: datetime
|
| 30 |
"""An ISO 8601 timestamp."""
|
| 31 |
updated_at: datetime
|
| 32 |
"""An ISO 8601 timestamp."""
|
| 33 |
+
stripe_customer_id: str | None = None
|
| 34 |
"""The Stripe customer ID of the Organization."""
|
| 35 |
+
allow_profiles_outside_organization: bool | None = None
|
| 36 |
"""Whether the Organization allows profiles outside of its managed domains.
|
| 37 |
|
| 38 |
.. deprecated:: This field is deprecated."""
|
| 39 |
|
| 40 |
@classmethod
|
| 41 |
+
def from_dict(cls, data: dict[str, Any]) -> Organization:
|
| 42 |
"""Deserialize from a dictionary."""
|
| 43 |
try:
|
| 44 |
return cls(
|
|
|
|
| 46 |
id=data["id"],
|
| 47 |
name=data["name"],
|
| 48 |
domains=[
|
| 49 |
+
OrganizationDomain.from_dict(cast(dict[str, Any], item))
|
| 50 |
for item in cast(list[Any], data["domains"])
|
| 51 |
],
|
| 52 |
metadata=data["metadata"],
|
|
|
|
| 61 |
except (KeyError, ValueError) as e:
|
| 62 |
_raise_deserialize_error("Organization", e)
|
| 63 |
|
| 64 |
+
def to_dict(self) -> dict[str, Any]:
|
| 65 |
"""Serialize to a dictionary."""
|
| 66 |
+
result: dict[str, Any] = {}
|
| 67 |
result["object"] = self.object
|
| 68 |
result["id"] = self.id
|
| 69 |
result["name"] = self.name
|
python/src/workos/organizations/models/organization_authorized_connect_application_list_data.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
| 8 |
-
from workos._types import _raise_deserialize_error
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.connect_application import (
|
| 11 |
ConnectApplication,
|
| 12 |
ConnectApplicationVariant,
|
|
@@ -21,18 +20,18 @@ class OrganizationAuthorizedConnectApplicationListData:
|
|
| 21 |
"""Distinguishes the authorized connect application object."""
|
| 22 |
id: str
|
| 23 |
"""The unique ID of the authorized connect application."""
|
| 24 |
-
granted_scopes:
|
| 25 |
"""The scopes granted by the user to the application."""
|
| 26 |
-
application:
|
| 27 |
user_id: str
|
| 28 |
"""The ID of the user who authorized the application."""
|
| 29 |
-
oauth_resource:
|
| 30 |
"""The OAuth resource associated with the authorized connect application, if one was requested."""
|
| 31 |
|
| 32 |
@classmethod
|
| 33 |
def from_dict(
|
| 34 |
-
cls, data:
|
| 35 |
-
) ->
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -40,7 +39,7 @@ class OrganizationAuthorizedConnectApplicationListData:
|
|
| 40 |
id=data["id"],
|
| 41 |
granted_scopes=data["granted_scopes"],
|
| 42 |
application=ConnectApplication.from_dict(
|
| 43 |
-
cast(
|
| 44 |
),
|
| 45 |
user_id=data["user_id"],
|
| 46 |
oauth_resource=data.get("oauth_resource"),
|
|
@@ -50,9 +49,9 @@ class OrganizationAuthorizedConnectApplicationListData:
|
|
| 50 |
"OrganizationAuthorizedConnectApplicationListData", e
|
| 51 |
)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["object"] = self.object
|
| 57 |
result["id"] = self.id
|
| 58 |
result["granted_scopes"] = self.granted_scopes
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, Literal, cast
|
|
|
|
| 7 |
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.connect_application import (
|
| 10 |
ConnectApplication,
|
| 11 |
ConnectApplicationVariant,
|
|
|
|
| 20 |
"""Distinguishes the authorized connect application object."""
|
| 21 |
id: str
|
| 22 |
"""The unique ID of the authorized connect application."""
|
| 23 |
+
granted_scopes: list[str]
|
| 24 |
"""The scopes granted by the user to the application."""
|
| 25 |
+
application: ConnectApplicationVariant
|
| 26 |
user_id: str
|
| 27 |
"""The ID of the user who authorized the application."""
|
| 28 |
+
oauth_resource: str | None = None
|
| 29 |
"""The OAuth resource associated with the authorized connect application, if one was requested."""
|
| 30 |
|
| 31 |
@classmethod
|
| 32 |
def from_dict(
|
| 33 |
+
cls, data: dict[str, Any]
|
| 34 |
+
) -> OrganizationAuthorizedConnectApplicationListData:
|
| 35 |
"""Deserialize from a dictionary."""
|
| 36 |
try:
|
| 37 |
return cls(
|
|
|
|
| 39 |
id=data["id"],
|
| 40 |
granted_scopes=data["granted_scopes"],
|
| 41 |
application=ConnectApplication.from_dict(
|
| 42 |
+
cast(dict[str, Any], data["application"])
|
| 43 |
),
|
| 44 |
user_id=data["user_id"],
|
| 45 |
oauth_resource=data.get("oauth_resource"),
|
|
|
|
| 49 |
"OrganizationAuthorizedConnectApplicationListData", e
|
| 50 |
)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["granted_scopes"] = self.granted_scopes
|
python/src/workos/organizations/models/organization_domain_data.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.organization_domain_data_state import (
|
| 10 |
OrganizationDomainDataState,
|
|
@@ -17,11 +18,11 @@ class OrganizationDomainData:
|
|
| 17 |
|
| 18 |
domain: str
|
| 19 |
"""The domain value."""
|
| 20 |
-
state:
|
| 21 |
"""The verification state of the domain."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -31,9 +32,9 @@ class OrganizationDomainData:
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("OrganizationDomainData", e)
|
| 33 |
|
| 34 |
-
def to_dict(self) ->
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
-
result:
|
| 37 |
result["domain"] = self.domain
|
| 38 |
result["state"] = (
|
| 39 |
self.state.value if isinstance(self.state, Enum) else self.state
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.organization_domain_data_state import (
|
| 11 |
OrganizationDomainDataState,
|
|
|
|
| 18 |
|
| 19 |
domain: str
|
| 20 |
"""The domain value."""
|
| 21 |
+
state: OrganizationDomainDataState
|
| 22 |
"""The verification state of the domain."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationDomainData:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 32 |
except (KeyError, ValueError) as e:
|
| 33 |
_raise_deserialize_error("OrganizationDomainData", e)
|
| 34 |
|
| 35 |
+
def to_dict(self) -> dict[str, Any]:
|
| 36 |
"""Serialize to a dictionary."""
|
| 37 |
+
result: dict[str, Any] = {}
|
| 38 |
result["domain"] = self.domain
|
| 39 |
result["state"] = (
|
| 40 |
self.state.value if isinstance(self.state, Enum) else self.state
|
python/src/workos/organizations/models/organization_input.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .organization_domain_data import OrganizationDomainData
|
|
@@ -16,19 +16,19 @@ class OrganizationInput:
|
|
| 16 |
|
| 17 |
name: str
|
| 18 |
"""The name of the organization."""
|
| 19 |
-
allow_profiles_outside_organization:
|
| 20 |
"""Whether the organization allows profiles from outside the organization to sign in."""
|
| 21 |
-
domains:
|
| 22 |
"""The domains associated with the organization. Deprecated in favor of `domain_data`."""
|
| 23 |
-
domain_data:
|
| 24 |
"""The domains associated with the organization, including verification state."""
|
| 25 |
-
metadata:
|
| 26 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 27 |
-
external_id:
|
| 28 |
"""An external identifier for the Organization."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
-
def from_dict(cls, data:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
@@ -38,7 +38,7 @@ class OrganizationInput:
|
|
| 38 |
),
|
| 39 |
domains=data.get("domains"),
|
| 40 |
domain_data=[
|
| 41 |
-
OrganizationDomainData.from_dict(cast(
|
| 42 |
for item in cast(list[Any], _v_domain_data)
|
| 43 |
]
|
| 44 |
if (_v_domain_data := data.get("domain_data")) is not None
|
|
@@ -49,9 +49,9 @@ class OrganizationInput:
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("OrganizationInput", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["name"] = self.name
|
| 56 |
if self.allow_profiles_outside_organization is not None:
|
| 57 |
result["allow_profiles_outside_organization"] = (
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .organization_domain_data import OrganizationDomainData
|
|
|
|
| 16 |
|
| 17 |
name: str
|
| 18 |
"""The name of the organization."""
|
| 19 |
+
allow_profiles_outside_organization: bool | None = None
|
| 20 |
"""Whether the organization allows profiles from outside the organization to sign in."""
|
| 21 |
+
domains: list[str] | None = None
|
| 22 |
"""The domains associated with the organization. Deprecated in favor of `domain_data`."""
|
| 23 |
+
domain_data: list[OrganizationDomainData] | None = None
|
| 24 |
"""The domains associated with the organization, including verification state."""
|
| 25 |
+
metadata: dict[str, str] | None = None
|
| 26 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 27 |
+
external_id: str | None = None
|
| 28 |
"""An external identifier for the Organization."""
|
| 29 |
|
| 30 |
@classmethod
|
| 31 |
+
def from_dict(cls, data: dict[str, Any]) -> OrganizationInput:
|
| 32 |
"""Deserialize from a dictionary."""
|
| 33 |
try:
|
| 34 |
return cls(
|
|
|
|
| 38 |
),
|
| 39 |
domains=data.get("domains"),
|
| 40 |
domain_data=[
|
| 41 |
+
OrganizationDomainData.from_dict(cast(dict[str, Any], item))
|
| 42 |
for item in cast(list[Any], _v_domain_data)
|
| 43 |
]
|
| 44 |
if (_v_domain_data := data.get("domain_data")) is not None
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("OrganizationInput", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["name"] = self.name
|
| 56 |
if self.allow_profiles_outside_organization is not None:
|
| 57 |
result["allow_profiles_outside_organization"] = (
|
python/src/workos/organizations/models/update_audit_logs_retention.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class UpdateAuditLogsRetention:
|
|
| 15 |
"""The number of days Audit Log events will be retained. Valid values are `30` and `365`."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class UpdateAuditLogsRetention:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("UpdateAuditLogsRetention", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""The number of days Audit Log events will be retained. Valid values are `30` and `365`."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateAuditLogsRetention:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("UpdateAuditLogsRetention", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["retention_period_in_days"] = self.retention_period_in_days
|
| 32 |
return result
|
python/src/workos/organizations/models/update_organization.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .organization_domain_data import OrganizationDomainData
|
|
@@ -14,25 +14,25 @@ from .organization_domain_data import OrganizationDomainData
|
|
| 14 |
class UpdateOrganization:
|
| 15 |
"""Update Organization model."""
|
| 16 |
|
| 17 |
-
name:
|
| 18 |
"""The name of the organization."""
|
| 19 |
-
allow_profiles_outside_organization:
|
| 20 |
"""Whether the organization allows profiles from outside the organization to sign in."""
|
| 21 |
-
domains:
|
| 22 |
"""The domains associated with the organization. Deprecated in favor of `domain_data`.
|
| 23 |
|
| 24 |
.. deprecated:: This field is deprecated."""
|
| 25 |
-
domain_data:
|
| 26 |
"""The domains associated with the organization, including verification state."""
|
| 27 |
-
stripe_customer_id:
|
| 28 |
"""The Stripe customer ID associated with the organization."""
|
| 29 |
-
metadata:
|
| 30 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 31 |
-
external_id:
|
| 32 |
"""An external identifier for the Organization."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
-
def from_dict(cls, data:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -42,7 +42,7 @@ class UpdateOrganization:
|
|
| 42 |
),
|
| 43 |
domains=data.get("domains"),
|
| 44 |
domain_data=[
|
| 45 |
-
OrganizationDomainData.from_dict(cast(
|
| 46 |
for item in cast(list[Any], _v_domain_data)
|
| 47 |
]
|
| 48 |
if (_v_domain_data := data.get("domain_data")) is not None
|
|
@@ -54,9 +54,9 @@ class UpdateOrganization:
|
|
| 54 |
except (KeyError, ValueError) as e:
|
| 55 |
_raise_deserialize_error("UpdateOrganization", e)
|
| 56 |
|
| 57 |
-
def to_dict(self) ->
|
| 58 |
"""Serialize to a dictionary."""
|
| 59 |
-
result:
|
| 60 |
if self.name is not None:
|
| 61 |
result["name"] = self.name
|
| 62 |
if self.allow_profiles_outside_organization is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .organization_domain_data import OrganizationDomainData
|
|
|
|
| 14 |
class UpdateOrganization:
|
| 15 |
"""Update Organization model."""
|
| 16 |
|
| 17 |
+
name: str | None = None
|
| 18 |
"""The name of the organization."""
|
| 19 |
+
allow_profiles_outside_organization: bool | None = None
|
| 20 |
"""Whether the organization allows profiles from outside the organization to sign in."""
|
| 21 |
+
domains: list[str] | None = None
|
| 22 |
"""The domains associated with the organization. Deprecated in favor of `domain_data`.
|
| 23 |
|
| 24 |
.. deprecated:: This field is deprecated."""
|
| 25 |
+
domain_data: list[OrganizationDomainData] | None = None
|
| 26 |
"""The domains associated with the organization, including verification state."""
|
| 27 |
+
stripe_customer_id: str | None = None
|
| 28 |
"""The Stripe customer ID associated with the organization."""
|
| 29 |
+
metadata: dict[str, str] | None = None
|
| 30 |
"""Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization."""
|
| 31 |
+
external_id: str | None = None
|
| 32 |
"""An external identifier for the Organization."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateOrganization:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
|
|
| 42 |
),
|
| 43 |
domains=data.get("domains"),
|
| 44 |
domain_data=[
|
| 45 |
+
OrganizationDomainData.from_dict(cast(dict[str, Any], item))
|
| 46 |
for item in cast(list[Any], _v_domain_data)
|
| 47 |
]
|
| 48 |
if (_v_domain_data := data.get("domain_data")) is not None
|
|
|
|
| 54 |
except (KeyError, ValueError) as e:
|
| 55 |
_raise_deserialize_error("UpdateOrganization", e)
|
| 56 |
|
| 57 |
+
def to_dict(self) -> dict[str, Any]:
|
| 58 |
"""Serialize to a dictionary."""
|
| 59 |
+
result: dict[str, Any] = {}
|
| 60 |
if self.name is not None:
|
| 61 |
result["name"] = self.name
|
| 62 |
if self.allow_profiles_outside_organization is not None:
|
python/src/workos/pipes/_resource.py|
@@ -99,14 +99,14 @@ class Pipes:
|
|
| 99 |
) -> DataIntegration:
|
| 100 |
"""Create a data integration
|
| 101 |
|
| 102 |
-
Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 103 |
|
| 104 |
Args:
|
| 105 |
provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 106 |
description: An optional description of the Data Integration.
|
| 107 |
enabled: Whether the Data Integration is enabled. Defaults to `false`.
|
| 108 |
scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 109 |
-
auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 110 |
config: Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 111 |
credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 112 |
api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
@@ -375,6 +375,61 @@ class Pipes:
|
|
| 375 |
request_options=request_options,
|
| 376 |
)
|
| 377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
def create_data_integration_credential(
|
| 379 |
self,
|
| 380 |
slug: str,
|
|
@@ -400,6 +455,7 @@ class Pipes:
|
|
| 400 |
BadRequestError: If the request is malformed (400).
|
| 401 |
AuthenticationError: If the API key is invalid (401).
|
| 402 |
NotFoundError: If the resource is not found (404).
|
|
|
|
| 403 |
RateLimitExceededError: If rate limited (429).
|
| 404 |
ServerError: If the server returns a 5xx error.
|
| 405 |
"""
|
|
@@ -804,14 +860,14 @@ class AsyncPipes:
|
|
| 804 |
) -> DataIntegration:
|
| 805 |
"""Create a data integration
|
| 806 |
|
| 807 |
-
Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 808 |
|
| 809 |
Args:
|
| 810 |
provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 811 |
description: An optional description of the Data Integration.
|
| 812 |
enabled: Whether the Data Integration is enabled. Defaults to `false`.
|
| 813 |
scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 814 |
-
auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 815 |
config: Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 816 |
credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 817 |
api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
@@ -1080,6 +1136,61 @@ class AsyncPipes:
|
|
| 1080 |
request_options=request_options,
|
| 1081 |
)
|
| 1082 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1083 |
async def create_data_integration_credential(
|
| 1084 |
self,
|
| 1085 |
slug: str,
|
|
@@ -1105,6 +1216,7 @@ class AsyncPipes:
|
|
| 1105 |
BadRequestError: If the request is malformed (400).
|
| 1106 |
AuthenticationError: If the API key is invalid (401).
|
| 1107 |
NotFoundError: If the resource is not found (404).
|
|
|
|
| 1108 |
RateLimitExceededError: If rate limited (429).
|
| 1109 |
ServerError: If the server returns a 5xx error.
|
| 1110 |
"""
|
|
|
|
| 99 |
) -> DataIntegration:
|
| 100 |
"""Create a data integration
|
| 101 |
|
| 102 |
+
Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 103 |
|
| 104 |
Args:
|
| 105 |
provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 106 |
description: An optional description of the Data Integration.
|
| 107 |
enabled: Whether the Data Integration is enabled. Defaults to `false`.
|
| 108 |
scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 109 |
+
auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 110 |
config: Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 111 |
credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 112 |
api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
|
|
| 375 |
request_options=request_options,
|
| 376 |
)
|
| 377 |
|
| 378 |
+
def update_data_integration_client_credentials(
|
| 379 |
+
self,
|
| 380 |
+
slug: str,
|
| 381 |
+
*,
|
| 382 |
+
user_id: str,
|
| 383 |
+
client_id: str,
|
| 384 |
+
client_secret: str,
|
| 385 |
+
organization_id: str | None = None,
|
| 386 |
+
config: dict[str, str] | None = None,
|
| 387 |
+
request_options: RequestOptions | None = None,
|
| 388 |
+
) -> ConnectedAccount:
|
| 389 |
+
"""Upsert client credentials for a connected account
|
| 390 |
+
|
| 391 |
+
Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 392 |
+
|
| 393 |
+
Args:
|
| 394 |
+
slug: The identifier of the integration.
|
| 395 |
+
user_id: A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 396 |
+
organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 397 |
+
client_id: The OAuth client ID to store for this integration.
|
| 398 |
+
client_secret: The OAuth client secret to store for this integration.
|
| 399 |
+
config: Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 400 |
+
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
|
| 401 |
+
|
| 402 |
+
Returns:
|
| 403 |
+
ConnectedAccount
|
| 404 |
+
|
| 405 |
+
Raises:
|
| 406 |
+
BadRequestError: If the request is malformed (400).
|
| 407 |
+
AuthenticationError: If the API key is invalid (401).
|
| 408 |
+
AuthorizationError: If the request is forbidden (403).
|
| 409 |
+
NotFoundError: If the resource is not found (404).
|
| 410 |
+
UnprocessableEntityError: If the request data is unprocessable (422).
|
| 411 |
+
RateLimitExceededError: If rate limited (429).
|
| 412 |
+
ServerError: If the server returns a 5xx error.
|
| 413 |
+
"""
|
| 414 |
+
body: dict[str, Any] = {
|
| 415 |
+
k: v
|
| 416 |
+
for k, v in {
|
| 417 |
+
"user_id": user_id,
|
| 418 |
+
"organization_id": organization_id,
|
| 419 |
+
"client_id": client_id,
|
| 420 |
+
"client_secret": client_secret,
|
| 421 |
+
"config": config,
|
| 422 |
+
}.items()
|
| 423 |
+
if v is not None
|
| 424 |
+
}
|
| 425 |
+
return self._client.request(
|
| 426 |
+
method="put",
|
| 427 |
+
path=("data-integrations", str(slug), "client-credentials"),
|
| 428 |
+
body=body,
|
| 429 |
+
model=ConnectedAccount,
|
| 430 |
+
request_options=request_options,
|
| 431 |
+
)
|
| 432 |
+
|
| 433 |
def create_data_integration_credential(
|
| 434 |
self,
|
| 435 |
slug: str,
|
|
|
|
| 455 |
BadRequestError: If the request is malformed (400).
|
| 456 |
AuthenticationError: If the API key is invalid (401).
|
| 457 |
NotFoundError: If the resource is not found (404).
|
| 458 |
+
UnprocessableEntityError: If the request data is unprocessable (422).
|
| 459 |
RateLimitExceededError: If rate limited (429).
|
| 460 |
ServerError: If the server returns a 5xx error.
|
| 461 |
"""
|
|
|
|
| 860 |
) -> DataIntegration:
|
| 861 |
"""Create a data integration
|
| 862 |
|
| 863 |
+
Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 864 |
|
| 865 |
Args:
|
| 866 |
provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug.
|
| 867 |
description: An optional description of the Data Integration.
|
| 868 |
enabled: Whether the Data Integration is enabled. Defaults to `false`.
|
| 869 |
scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 870 |
+
auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 871 |
config: Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 872 |
credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 873 |
api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
|
|
| 1136 |
request_options=request_options,
|
| 1137 |
)
|
| 1138 |
|
| 1139 |
+
async def update_data_integration_client_credentials(
|
| 1140 |
+
self,
|
| 1141 |
+
slug: str,
|
| 1142 |
+
*,
|
| 1143 |
+
user_id: str,
|
| 1144 |
+
client_id: str,
|
| 1145 |
+
client_secret: str,
|
| 1146 |
+
organization_id: str | None = None,
|
| 1147 |
+
config: dict[str, str] | None = None,
|
| 1148 |
+
request_options: RequestOptions | None = None,
|
| 1149 |
+
) -> ConnectedAccount:
|
| 1150 |
+
"""Upsert client credentials for a connected account
|
| 1151 |
+
|
| 1152 |
+
Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 1153 |
+
|
| 1154 |
+
Args:
|
| 1155 |
+
slug: The identifier of the integration.
|
| 1156 |
+
user_id: A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 1157 |
+
organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 1158 |
+
client_id: The OAuth client ID to store for this integration.
|
| 1159 |
+
client_secret: The OAuth client secret to store for this integration.
|
| 1160 |
+
config: Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 1161 |
+
request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override.
|
| 1162 |
+
|
| 1163 |
+
Returns:
|
| 1164 |
+
ConnectedAccount
|
| 1165 |
+
|
| 1166 |
+
Raises:
|
| 1167 |
+
BadRequestError: If the request is malformed (400).
|
| 1168 |
+
AuthenticationError: If the API key is invalid (401).
|
| 1169 |
+
AuthorizationError: If the request is forbidden (403).
|
| 1170 |
+
NotFoundError: If the resource is not found (404).
|
| 1171 |
+
UnprocessableEntityError: If the request data is unprocessable (422).
|
| 1172 |
+
RateLimitExceededError: If rate limited (429).
|
| 1173 |
+
ServerError: If the server returns a 5xx error.
|
| 1174 |
+
"""
|
| 1175 |
+
body: dict[str, Any] = {
|
| 1176 |
+
k: v
|
| 1177 |
+
for k, v in {
|
| 1178 |
+
"user_id": user_id,
|
| 1179 |
+
"organization_id": organization_id,
|
| 1180 |
+
"client_id": client_id,
|
| 1181 |
+
"client_secret": client_secret,
|
| 1182 |
+
"config": config,
|
| 1183 |
+
}.items()
|
| 1184 |
+
if v is not None
|
| 1185 |
+
}
|
| 1186 |
+
return await self._client.request(
|
| 1187 |
+
method="put",
|
| 1188 |
+
path=("data-integrations", str(slug), "client-credentials"),
|
| 1189 |
+
body=body,
|
| 1190 |
+
model=ConnectedAccount,
|
| 1191 |
+
request_options=request_options,
|
| 1192 |
+
)
|
| 1193 |
+
|
| 1194 |
async def create_data_integration_credential(
|
| 1195 |
self,
|
| 1196 |
slug: str,
|
|
|
|
| 1216 |
BadRequestError: If the request is malformed (400).
|
| 1217 |
AuthenticationError: If the API key is invalid (401).
|
| 1218 |
NotFoundError: If the resource is not found (404).
|
| 1219 |
+
UnprocessableEntityError: If the request data is unprocessable (422).
|
| 1220 |
RateLimitExceededError: If rate limited (429).
|
| 1221 |
ServerError: If the server returns a 5xx error.
|
| 1222 |
"""
|
python/src/workos/pipes/models/__init__.py|
@@ -54,6 +54,9 @@ from .data_integrations_list_response_data_connected_account import (
|
|
| 54 |
from .data_integrations_upsert_api_key_request import (
|
| 55 |
DataIntegrationsUpsertApiKeyRequest as DataIntegrationsUpsertApiKeyRequest,
|
| 56 |
)
|
|
|
|
|
|
|
|
|
|
| 57 |
from .data_integrations_vend_credentials_request import (
|
| 58 |
DataIntegrationsVendCredentialsRequest as DataIntegrationsVendCredentialsRequest,
|
| 59 |
)
|
|
|
|
| 54 |
from .data_integrations_upsert_api_key_request import (
|
| 55 |
DataIntegrationsUpsertApiKeyRequest as DataIntegrationsUpsertApiKeyRequest,
|
| 56 |
)
|
| 57 |
+
from .data_integrations_upsert_client_credentials_request import (
|
| 58 |
+
DataIntegrationsUpsertClientCredentialsRequest as DataIntegrationsUpsertClientCredentialsRequest,
|
| 59 |
+
)
|
| 60 |
from .data_integrations_vend_credentials_request import (
|
| 61 |
DataIntegrationsVendCredentialsRequest as DataIntegrationsVendCredentialsRequest,
|
| 62 |
)
|
python/src/workos/pipes/models/create_data_integration.py|
@@ -29,7 +29,7 @@ class CreateDataIntegration:
|
|
| 29 |
scopes: list[str] | None = None
|
| 30 |
"""The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted."""
|
| 31 |
auth_methods: list[CreateDataIntegrationAuthMethods] | None = None
|
| 32 |
-
"""How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request)."""
|
| 33 |
config: dict[str, str] | None = None
|
| 34 |
"""Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted."""
|
| 35 |
credentials: DataIntegrationCredentialsInput | None = None
|
|
|
|
| 29 |
scopes: list[str] | None = None
|
| 30 |
"""The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted."""
|
| 31 |
auth_methods: list[CreateDataIntegrationAuthMethods] | None = None
|
| 32 |
+
"""How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant."""
|
| 33 |
config: dict[str, str] | None = None
|
| 34 |
"""Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted."""
|
| 35 |
credentials: DataIntegrationCredentialsInput | None = None
|
python/src/workos/pipes/models/custom_provider_definition.py|
@@ -18,10 +18,10 @@ class CustomProviderDefinition:
|
|
| 18 |
|
| 19 |
name: str
|
| 20 |
"""A descriptive name for the custom provider."""
|
| 21 |
-
authorization_url: str
|
| 22 |
-
"""The provider's OAuth authorization endpoint."""
|
| 23 |
-
token_url: str
|
| 24 |
-
"""The provider's OAuth token endpoint."""
|
| 25 |
refresh_token_url: str | None = None
|
| 26 |
"""The endpoint used to refresh tokens, if different from the token endpoint."""
|
| 27 |
pkce_enabled: bool | None = None
|
|
@@ -45,8 +45,8 @@ class CustomProviderDefinition:
|
|
| 45 |
try:
|
| 46 |
return cls(
|
| 47 |
name=data["name"],
|
| 48 |
-
authorization_url=data
|
| 49 |
-
token_url=data
|
| 50 |
refresh_token_url=data.get("refresh_token_url"),
|
| 51 |
pkce_enabled=data.get("pkce_enabled"),
|
| 52 |
request_scope_separator=data.get("request_scope_separator"),
|
|
@@ -69,8 +69,10 @@ class CustomProviderDefinition:
|
|
| 69 |
"""Serialize to a dictionary."""
|
| 70 |
result: dict[str, Any] = {}
|
| 71 |
result["name"] = self.name
|
|
|
|
| 72 |
-
|
|
|
|
| 73 |
-
|
| 74 |
if self.refresh_token_url is not None:
|
| 75 |
result["refresh_token_url"] = self.refresh_token_url
|
| 76 |
else:
|
|
|
|
| 18 |
|
| 19 |
name: str
|
| 20 |
"""A descriptive name for the custom provider."""
|
| 21 |
+
authorization_url: str | None = None
|
| 22 |
+
"""The provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers."""
|
| 23 |
+
token_url: str | None = None
|
| 24 |
+
"""The provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers."""
|
| 25 |
refresh_token_url: str | None = None
|
| 26 |
"""The endpoint used to refresh tokens, if different from the token endpoint."""
|
| 27 |
pkce_enabled: bool | None = None
|
|
|
|
| 45 |
try:
|
| 46 |
return cls(
|
| 47 |
name=data["name"],
|
| 48 |
+
authorization_url=data.get("authorization_url"),
|
| 49 |
+
token_url=data.get("token_url"),
|
| 50 |
refresh_token_url=data.get("refresh_token_url"),
|
| 51 |
pkce_enabled=data.get("pkce_enabled"),
|
| 52 |
request_scope_separator=data.get("request_scope_separator"),
|
|
|
|
| 69 |
"""Serialize to a dictionary."""
|
| 70 |
result: dict[str, Any] = {}
|
| 71 |
result["name"] = self.name
|
| 72 |
+
if self.authorization_url is not None:
|
| 73 |
+
result["authorization_url"] = self.authorization_url
|
| 74 |
+
if self.token_url is not None:
|
| 75 |
+
result["token_url"] = self.token_url
|
| 76 |
if self.refresh_token_url is not None:
|
| 77 |
result["refresh_token_url"] = self.refresh_token_url
|
| 78 |
else:
|
python/src/workos/pipes/models/data_integration.py|
@@ -42,8 +42,8 @@ class DataIntegration:
|
|
| 42 |
"""The OAuth redirect URI to register with the provider when configuring the custom application."""
|
| 43 |
auth_methods: list[DataIntegrationAuthMethods]
|
| 44 |
"""How accounts authenticate with the provider for this Data Integration."""
|
| 45 |
-
credentials: DataIntegrationCredential
|
| 46 |
-
"""The credentials
|
| 47 |
installation: DataIntegrationInstallation | None
|
| 48 |
"""The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses."""
|
| 49 |
config: dict[str, str]
|
|
@@ -74,8 +74,10 @@ class DataIntegration:
|
|
| 74 |
for item in cast(list[Any], data["auth_methods"])
|
| 75 |
],
|
| 76 |
credentials=DataIntegrationCredential.from_dict(
|
| 77 |
-
cast(dict[str, Any],
|
| 78 |
-
)
|
|
|
|
|
|
|
| 79 |
installation=DataIntegrationInstallation.from_dict(
|
| 80 |
cast(dict[str, Any], _v_installation)
|
| 81 |
)
|
|
@@ -116,7 +118,10 @@ class DataIntegration:
|
|
| 116 |
result["auth_methods"] = [
|
| 117 |
item.value if isinstance(item, Enum) else item for item in self.auth_methods
|
| 118 |
]
|
|
|
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
if self.installation is not None:
|
| 121 |
result["installation"] = self.installation.to_dict()
|
| 122 |
else:
|
|
|
|
| 42 |
"""The OAuth redirect URI to register with the provider when configuring the custom application."""
|
| 43 |
auth_methods: list[DataIntegrationAuthMethods]
|
| 44 |
"""How accounts authenticate with the provider for this Data Integration."""
|
| 45 |
+
credentials: DataIntegrationCredential | None
|
| 46 |
+
"""The integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant)."""
|
| 47 |
installation: DataIntegrationInstallation | None
|
| 48 |
"""The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses."""
|
| 49 |
config: dict[str, str]
|
|
|
|
| 74 |
for item in cast(list[Any], data["auth_methods"])
|
| 75 |
],
|
| 76 |
credentials=DataIntegrationCredential.from_dict(
|
| 77 |
+
cast(dict[str, Any], _v_credentials)
|
| 78 |
+
)
|
| 79 |
+
if (_v_credentials := data["credentials"]) is not None
|
| 80 |
+
else None,
|
| 81 |
installation=DataIntegrationInstallation.from_dict(
|
| 82 |
cast(dict[str, Any], _v_installation)
|
| 83 |
)
|
|
|
|
| 118 |
result["auth_methods"] = [
|
| 119 |
item.value if isinstance(item, Enum) else item for item in self.auth_methods
|
| 120 |
]
|
| 121 |
+
if self.credentials is not None:
|
| 122 |
+
result["credentials"] = self.credentials.to_dict()
|
| 123 |
+
else:
|
| 124 |
+
result["credentials"] = None
|
| 125 |
if self.installation is not None:
|
| 126 |
result["installation"] = self.installation.to_dict()
|
| 127 |
else:
|
python/src/workos/pipes/models/data_integration_credential.py|
@@ -14,7 +14,7 @@ from workos.common.models.data_integration_credential_type import (
|
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
| 16 |
class DataIntegrationCredential:
|
| 17 |
-
"""
|
| 18 |
|
| 19 |
type: DataIntegrationCredentialType
|
| 20 |
"""The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself)."""
|
|
|
|
| 14 |
|
| 15 |
@dataclass(slots=True)
|
| 16 |
class DataIntegrationCredential:
|
| 17 |
+
"""Data Integration Credential model."""
|
| 18 |
|
| 19 |
type: DataIntegrationCredentialType
|
| 20 |
"""The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself)."""
|
python/src/workos/pipes/models/data_integrations_list_response_data_connected_account.py|
@@ -44,6 +44,12 @@ class DataIntegrationsListResponseDataConnectedAccount:
|
|
| 44 |
"""The authentication method used for this connection (`oauth`, `api_key`, or `client_credentials`). Defaults to `oauth` if absent."""
|
| 45 |
api_key_last_4: str | None = None
|
| 46 |
"""The last four characters of the API key, or `null` for OAuth connections."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
userland_user_id: str | None = None
|
| 48 |
"""Use `user_id` instead.
|
| 49 |
|
|
@@ -72,6 +78,9 @@ class DataIntegrationsListResponseDataConnectedAccount:
|
|
| 72 |
if (_v_auth_method := data.get("auth_method")) is not None
|
| 73 |
else None,
|
| 74 |
api_key_last_4=data.get("api_key_last_4"),
|
|
|
|
|
|
|
|
|
|
| 75 |
userland_user_id=data.get("userlandUserId"),
|
| 76 |
)
|
| 77 |
except (KeyError, ValueError) as e:
|
|
@@ -108,6 +117,16 @@ class DataIntegrationsListResponseDataConnectedAccount:
|
|
| 108 |
result["api_key_last_4"] = self.api_key_last_4
|
| 109 |
else:
|
| 110 |
result["api_key_last_4"] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
if self.userland_user_id is not None:
|
| 112 |
result["userlandUserId"] = self.userland_user_id
|
| 113 |
else:
|
|
|
|
| 44 |
"""The authentication method used for this connection (`oauth`, `api_key`, or `client_credentials`). Defaults to `oauth` if absent."""
|
| 45 |
api_key_last_4: str | None = None
|
| 46 |
"""The last four characters of the API key, or `null` for OAuth connections."""
|
| 47 |
+
client_id: str | None = None
|
| 48 |
+
"""The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`."""
|
| 49 |
+
client_secret_last_4: str | None = None
|
| 50 |
+
"""The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`."""
|
| 51 |
+
config: dict[str, str] | None = None
|
| 52 |
+
"""The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`."""
|
| 53 |
userland_user_id: str | None = None
|
| 54 |
"""Use `user_id` instead.
|
| 55 |
|
|
|
|
| 78 |
if (_v_auth_method := data.get("auth_method")) is not None
|
| 79 |
else None,
|
| 80 |
api_key_last_4=data.get("api_key_last_4"),
|
| 81 |
+
client_id=data.get("client_id"),
|
| 82 |
+
client_secret_last_4=data.get("client_secret_last_4"),
|
| 83 |
+
config=data.get("config"),
|
| 84 |
userland_user_id=data.get("userlandUserId"),
|
| 85 |
)
|
| 86 |
except (KeyError, ValueError) as e:
|
|
|
|
| 117 |
result["api_key_last_4"] = self.api_key_last_4
|
| 118 |
else:
|
| 119 |
result["api_key_last_4"] = None
|
| 120 |
+
if self.client_id is not None:
|
| 121 |
+
result["client_id"] = self.client_id
|
| 122 |
+
else:
|
| 123 |
+
result["client_id"] = None
|
| 124 |
+
if self.client_secret_last_4 is not None:
|
| 125 |
+
result["client_secret_last_4"] = self.client_secret_last_4
|
| 126 |
+
else:
|
| 127 |
+
result["client_secret_last_4"] = None
|
| 128 |
+
if self.config is not None:
|
| 129 |
+
result["config"] = self.config
|
| 130 |
if self.userland_user_id is not None:
|
| 131 |
result["userlandUserId"] = self.userland_user_id
|
| 132 |
else:
|
python/src/workos/pipes/models/data_integrations_upsert_client_credentials_request.py|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@dataclass(slots=True)
|
| 12 |
+
class DataIntegrationsUpsertClientCredentialsRequest:
|
| 13 |
+
"""Data Integrations Upsert Client Credentials Request model."""
|
| 14 |
+
|
| 15 |
+
user_id: str
|
| 16 |
+
"""A [User](https://workos.com/docs/reference/authkit/user) identifier."""
|
| 17 |
+
client_id: str
|
| 18 |
+
"""The OAuth client ID to store for this integration."""
|
| 19 |
+
client_secret: str
|
| 20 |
+
"""The OAuth client secret to store for this integration."""
|
| 21 |
+
organization_id: str | None = None
|
| 22 |
+
"""An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization."""
|
| 23 |
+
config: dict[str, str] | None = None
|
| 24 |
+
"""Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors."""
|
| 25 |
+
|
| 26 |
+
@classmethod
|
| 27 |
+
def from_dict(
|
| 28 |
+
cls, data: dict[str, Any]
|
| 29 |
+
) -> DataIntegrationsUpsertClientCredentialsRequest:
|
| 30 |
+
"""Deserialize from a dictionary."""
|
| 31 |
+
try:
|
| 32 |
+
return cls(
|
| 33 |
+
user_id=data["user_id"],
|
| 34 |
+
client_id=data["client_id"],
|
| 35 |
+
client_secret=data["client_secret"],
|
| 36 |
+
organization_id=data.get("organization_id"),
|
| 37 |
+
config=data.get("config"),
|
| 38 |
+
)
|
| 39 |
+
except (KeyError, ValueError) as e:
|
| 40 |
+
_raise_deserialize_error(
|
| 41 |
+
"DataIntegrationsUpsertClientCredentialsRequest", e
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
def to_dict(self) -> dict[str, Any]:
|
| 45 |
+
"""Serialize to a dictionary."""
|
| 46 |
+
result: dict[str, Any] = {}
|
| 47 |
+
result["user_id"] = self.user_id
|
| 48 |
+
result["client_id"] = self.client_id
|
| 49 |
+
result["client_secret"] = self.client_secret
|
| 50 |
+
if self.organization_id is not None:
|
| 51 |
+
result["organization_id"] = self.organization_id
|
| 52 |
+
if self.config is not None:
|
| 53 |
+
result["config"] = self.config
|
| 54 |
+
return result
|
python/src/workos/radar/_resource.py|
@@ -2,14 +2,11 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any,
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
-
from .models import RadarListEntryAlreadyPresentResponse, RadarStandaloneResponse
|
| 12 |
-
from .models import RadarListAction, RadarListType
|
| 13 |
from workos.common.models.radar_standalone_assess_request_action import (
|
| 14 |
RadarStandaloneAssessRequestAction,
|
| 15 |
)
|
|
@@ -17,11 +14,19 @@ from workos.common.models.radar_standalone_assess_request_auth_method import (
|
|
| 17 |
RadarStandaloneAssessRequestAuthMethod,
|
| 18 |
)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
class Radar:
|
| 22 |
"""Radar API resources."""
|
| 23 |
|
| 24 |
-
def __init__(self, client:
|
| 25 |
self._client = client
|
| 26 |
|
| 27 |
def create_attempt(
|
|
@@ -30,10 +35,10 @@ class Radar:
|
|
| 30 |
ip_address: str,
|
| 31 |
user_agent: str,
|
| 32 |
email: str,
|
| 33 |
-
auth_method:
|
| 34 |
-
action:
|
| 35 |
-
signals_id:
|
| 36 |
-
request_options:
|
| 37 |
) -> RadarStandaloneResponse:
|
| 38 |
"""Create an attempt
|
| 39 |
|
|
@@ -57,7 +62,7 @@ class Radar:
|
|
| 57 |
RateLimitExceededError: If rate limited (429).
|
| 58 |
ServerError: If the server returns a 5xx error.
|
| 59 |
"""
|
| 60 |
-
body:
|
| 61 |
k: v
|
| 62 |
for k, v in {
|
| 63 |
"ip_address": ip_address,
|
|
@@ -81,9 +86,9 @@ class Radar:
|
|
| 81 |
self,
|
| 82 |
id: str,
|
| 83 |
*,
|
| 84 |
-
challenge_status:
|
| 85 |
-
attempt_status:
|
| 86 |
-
request_options:
|
| 87 |
) -> None:
|
| 88 |
"""Update a Radar attempt
|
| 89 |
|
|
@@ -102,7 +107,7 @@ class Radar:
|
|
| 102 |
RateLimitExceededError: If rate limited (429).
|
| 103 |
ServerError: If the server returns a 5xx error.
|
| 104 |
"""
|
| 105 |
-
body:
|
| 106 |
k: v
|
| 107 |
for k, v in {
|
| 108 |
"challenge_status": challenge_status,
|
|
@@ -119,11 +124,11 @@ class Radar:
|
|
| 119 |
|
| 120 |
def add_list_entry(
|
| 121 |
self,
|
| 122 |
-
type:
|
| 123 |
-
action:
|
| 124 |
*,
|
| 125 |
entry: str,
|
| 126 |
-
request_options:
|
| 127 |
) -> RadarListEntryAlreadyPresentResponse:
|
| 128 |
"""Add an entry to a Radar list
|
| 129 |
|
|
@@ -144,7 +149,7 @@ class Radar:
|
|
| 144 |
RateLimitExceededError: If rate limited (429).
|
| 145 |
ServerError: If the server returns a 5xx error.
|
| 146 |
"""
|
| 147 |
-
body:
|
| 148 |
"entry": entry,
|
| 149 |
}
|
| 150 |
return self._client.request(
|
|
@@ -157,11 +162,11 @@ class Radar:
|
|
| 157 |
|
| 158 |
def remove_list_entry(
|
| 159 |
self,
|
| 160 |
-
type:
|
| 161 |
-
action:
|
| 162 |
*,
|
| 163 |
entry: str,
|
| 164 |
-
request_options:
|
| 165 |
) -> None:
|
| 166 |
"""Remove an entry from a Radar list
|
| 167 |
|
|
@@ -180,7 +185,7 @@ class Radar:
|
|
| 180 |
RateLimitExceededError: If rate limited (429).
|
| 181 |
ServerError: If the server returns a 5xx error.
|
| 182 |
"""
|
| 183 |
-
body:
|
| 184 |
"entry": entry,
|
| 185 |
}
|
| 186 |
self._client.request(
|
|
@@ -194,7 +199,7 @@ class Radar:
|
|
| 194 |
class AsyncRadar:
|
| 195 |
"""Radar API resources (async)."""
|
| 196 |
|
| 197 |
-
def __init__(self, client:
|
| 198 |
self._client = client
|
| 199 |
|
| 200 |
async def create_attempt(
|
|
@@ -203,10 +208,10 @@ class AsyncRadar:
|
|
| 203 |
ip_address: str,
|
| 204 |
user_agent: str,
|
| 205 |
email: str,
|
| 206 |
-
auth_method:
|
| 207 |
-
action:
|
| 208 |
-
signals_id:
|
| 209 |
-
request_options:
|
| 210 |
) -> RadarStandaloneResponse:
|
| 211 |
"""Create an attempt
|
| 212 |
|
|
@@ -230,7 +235,7 @@ class AsyncRadar:
|
|
| 230 |
RateLimitExceededError: If rate limited (429).
|
| 231 |
ServerError: If the server returns a 5xx error.
|
| 232 |
"""
|
| 233 |
-
body:
|
| 234 |
k: v
|
| 235 |
for k, v in {
|
| 236 |
"ip_address": ip_address,
|
|
@@ -254,9 +259,9 @@ class AsyncRadar:
|
|
| 254 |
self,
|
| 255 |
id: str,
|
| 256 |
*,
|
| 257 |
-
challenge_status:
|
| 258 |
-
attempt_status:
|
| 259 |
-
request_options:
|
| 260 |
) -> None:
|
| 261 |
"""Update a Radar attempt
|
| 262 |
|
|
@@ -275,7 +280,7 @@ class AsyncRadar:
|
|
| 275 |
RateLimitExceededError: If rate limited (429).
|
| 276 |
ServerError: If the server returns a 5xx error.
|
| 277 |
"""
|
| 278 |
-
body:
|
| 279 |
k: v
|
| 280 |
for k, v in {
|
| 281 |
"challenge_status": challenge_status,
|
|
@@ -292,11 +297,11 @@ class AsyncRadar:
|
|
| 292 |
|
| 293 |
async def add_list_entry(
|
| 294 |
self,
|
| 295 |
-
type:
|
| 296 |
-
action:
|
| 297 |
*,
|
| 298 |
entry: str,
|
| 299 |
-
request_options:
|
| 300 |
) -> RadarListEntryAlreadyPresentResponse:
|
| 301 |
"""Add an entry to a Radar list
|
| 302 |
|
|
@@ -317,7 +322,7 @@ class AsyncRadar:
|
|
| 317 |
RateLimitExceededError: If rate limited (429).
|
| 318 |
ServerError: If the server returns a 5xx error.
|
| 319 |
"""
|
| 320 |
-
body:
|
| 321 |
"entry": entry,
|
| 322 |
}
|
| 323 |
return await self._client.request(
|
|
@@ -330,11 +335,11 @@ class AsyncRadar:
|
|
| 330 |
|
| 331 |
async def remove_list_entry(
|
| 332 |
self,
|
| 333 |
-
type:
|
| 334 |
-
action:
|
| 335 |
*,
|
| 336 |
entry: str,
|
| 337 |
-
request_options:
|
| 338 |
) -> None:
|
| 339 |
"""Remove an entry from a Radar list
|
| 340 |
|
|
@@ -353,7 +358,7 @@ class AsyncRadar:
|
|
| 353 |
RateLimitExceededError: If rate limited (429).
|
| 354 |
ServerError: If the server returns a 5xx error.
|
| 355 |
"""
|
| 356 |
-
body:
|
| 357 |
"entry": entry,
|
| 358 |
}
|
| 359 |
await self._client.request(
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Literal
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
from workos.common.models.radar_standalone_assess_request_action import (
|
| 11 |
RadarStandaloneAssessRequestAction,
|
| 12 |
)
|
|
|
|
| 14 |
RadarStandaloneAssessRequestAuthMethod,
|
| 15 |
)
|
| 16 |
|
| 17 |
+
from .._types import RequestOptions, enum_value
|
| 18 |
+
from .models import (
|
| 19 |
+
RadarListAction,
|
| 20 |
+
RadarListEntryAlreadyPresentResponse,
|
| 21 |
+
RadarListType,
|
| 22 |
+
RadarStandaloneResponse,
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
|
| 26 |
class Radar:
|
| 27 |
"""Radar API resources."""
|
| 28 |
|
| 29 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 30 |
self._client = client
|
| 31 |
|
| 32 |
def create_attempt(
|
|
|
|
| 35 |
ip_address: str,
|
| 36 |
user_agent: str,
|
| 37 |
email: str,
|
| 38 |
+
auth_method: RadarStandaloneAssessRequestAuthMethod | str,
|
| 39 |
+
action: RadarStandaloneAssessRequestAction | str,
|
| 40 |
+
signals_id: str | None = None,
|
| 41 |
+
request_options: RequestOptions | None = None,
|
| 42 |
) -> RadarStandaloneResponse:
|
| 43 |
"""Create an attempt
|
| 44 |
|
|
|
|
| 62 |
RateLimitExceededError: If rate limited (429).
|
| 63 |
ServerError: If the server returns a 5xx error.
|
| 64 |
"""
|
| 65 |
+
body: dict[str, Any] = {
|
| 66 |
k: v
|
| 67 |
for k, v in {
|
| 68 |
"ip_address": ip_address,
|
|
|
|
| 86 |
self,
|
| 87 |
id: str,
|
| 88 |
*,
|
| 89 |
+
challenge_status: Literal["success"] | None = None,
|
| 90 |
+
attempt_status: Literal["success"] | None = None,
|
| 91 |
+
request_options: RequestOptions | None = None,
|
| 92 |
) -> None:
|
| 93 |
"""Update a Radar attempt
|
| 94 |
|
|
|
|
| 107 |
RateLimitExceededError: If rate limited (429).
|
| 108 |
ServerError: If the server returns a 5xx error.
|
| 109 |
"""
|
| 110 |
+
body: dict[str, Any] = {
|
| 111 |
k: v
|
| 112 |
for k, v in {
|
| 113 |
"challenge_status": challenge_status,
|
|
|
|
| 124 |
|
| 125 |
def add_list_entry(
|
| 126 |
self,
|
| 127 |
+
type: RadarListType | str,
|
| 128 |
+
action: RadarListAction | str,
|
| 129 |
*,
|
| 130 |
entry: str,
|
| 131 |
+
request_options: RequestOptions | None = None,
|
| 132 |
) -> RadarListEntryAlreadyPresentResponse:
|
| 133 |
"""Add an entry to a Radar list
|
| 134 |
|
|
|
|
| 149 |
RateLimitExceededError: If rate limited (429).
|
| 150 |
ServerError: If the server returns a 5xx error.
|
| 151 |
"""
|
| 152 |
+
body: dict[str, Any] = {
|
| 153 |
"entry": entry,
|
| 154 |
}
|
| 155 |
return self._client.request(
|
|
|
|
| 162 |
|
| 163 |
def remove_list_entry(
|
| 164 |
self,
|
| 165 |
+
type: RadarListType | str,
|
| 166 |
+
action: RadarListAction | str,
|
| 167 |
*,
|
| 168 |
entry: str,
|
| 169 |
+
request_options: RequestOptions | None = None,
|
| 170 |
) -> None:
|
| 171 |
"""Remove an entry from a Radar list
|
| 172 |
|
|
|
|
| 185 |
RateLimitExceededError: If rate limited (429).
|
| 186 |
ServerError: If the server returns a 5xx error.
|
| 187 |
"""
|
| 188 |
+
body: dict[str, Any] = {
|
| 189 |
"entry": entry,
|
| 190 |
}
|
| 191 |
self._client.request(
|
|
|
|
| 199 |
class AsyncRadar:
|
| 200 |
"""Radar API resources (async)."""
|
| 201 |
|
| 202 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 203 |
self._client = client
|
| 204 |
|
| 205 |
async def create_attempt(
|
|
|
|
| 208 |
ip_address: str,
|
| 209 |
user_agent: str,
|
| 210 |
email: str,
|
| 211 |
+
auth_method: RadarStandaloneAssessRequestAuthMethod | str,
|
| 212 |
+
action: RadarStandaloneAssessRequestAction | str,
|
| 213 |
+
signals_id: str | None = None,
|
| 214 |
+
request_options: RequestOptions | None = None,
|
| 215 |
) -> RadarStandaloneResponse:
|
| 216 |
"""Create an attempt
|
| 217 |
|
|
|
|
| 235 |
RateLimitExceededError: If rate limited (429).
|
| 236 |
ServerError: If the server returns a 5xx error.
|
| 237 |
"""
|
| 238 |
+
body: dict[str, Any] = {
|
| 239 |
k: v
|
| 240 |
for k, v in {
|
| 241 |
"ip_address": ip_address,
|
|
|
|
| 259 |
self,
|
| 260 |
id: str,
|
| 261 |
*,
|
| 262 |
+
challenge_status: Literal["success"] | None = None,
|
| 263 |
+
attempt_status: Literal["success"] | None = None,
|
| 264 |
+
request_options: RequestOptions | None = None,
|
| 265 |
) -> None:
|
| 266 |
"""Update a Radar attempt
|
| 267 |
|
|
|
|
| 280 |
RateLimitExceededError: If rate limited (429).
|
| 281 |
ServerError: If the server returns a 5xx error.
|
| 282 |
"""
|
| 283 |
+
body: dict[str, Any] = {
|
| 284 |
k: v
|
| 285 |
for k, v in {
|
| 286 |
"challenge_status": challenge_status,
|
|
|
|
| 297 |
|
| 298 |
async def add_list_entry(
|
| 299 |
self,
|
| 300 |
+
type: RadarListType | str,
|
| 301 |
+
action: RadarListAction | str,
|
| 302 |
*,
|
| 303 |
entry: str,
|
| 304 |
+
request_options: RequestOptions | None = None,
|
| 305 |
) -> RadarListEntryAlreadyPresentResponse:
|
| 306 |
"""Add an entry to a Radar list
|
| 307 |
|
|
|
|
| 322 |
RateLimitExceededError: If rate limited (429).
|
| 323 |
ServerError: If the server returns a 5xx error.
|
| 324 |
"""
|
| 325 |
+
body: dict[str, Any] = {
|
| 326 |
"entry": entry,
|
| 327 |
}
|
| 328 |
return await self._client.request(
|
|
|
|
| 335 |
|
| 336 |
async def remove_list_entry(
|
| 337 |
self,
|
| 338 |
+
type: RadarListType | str,
|
| 339 |
+
action: RadarListAction | str,
|
| 340 |
*,
|
| 341 |
entry: str,
|
| 342 |
+
request_options: RequestOptions | None = None,
|
| 343 |
) -> None:
|
| 344 |
"""Remove an entry from a Radar list
|
| 345 |
|
|
|
|
| 358 |
RateLimitExceededError: If rate limited (429).
|
| 359 |
ServerError: If the server returns a 5xx error.
|
| 360 |
"""
|
| 361 |
+
body: dict[str, Any] = {
|
| 362 |
"entry": entry,
|
| 363 |
}
|
| 364 |
await self._client.request(
|
python/src/workos/radar/models/radar_list_action.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class RadarListAction(str, Enum):
|
|
| 16 |
ALLOW = "allow"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
ALLOW = "allow"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> RadarListAction | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/radar/models/radar_list_entry_already_present_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class RadarListEntryAlreadyPresentResponse:
|
|
| 15 |
"""A message indicating the entry already exists."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class RadarListEntryAlreadyPresentResponse:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("RadarListEntryAlreadyPresentResponse", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["message"] = self.message
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""A message indicating the entry already exists."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> RadarListEntryAlreadyPresentResponse:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("RadarListEntryAlreadyPresentResponse", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["message"] = self.message
|
| 32 |
return result
|
python/src/workos/radar/models/radar_list_type.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -21,7 +20,7 @@ class RadarListType(str, Enum):
|
|
| 21 |
COUNTRY = "country"
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def _missing_(cls, value: object) ->
|
| 25 |
if not isinstance(value, str):
|
| 26 |
return None
|
| 27 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 20 |
COUNTRY = "country"
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def _missing_(cls, value: object) -> RadarListType | None:
|
| 24 |
if not isinstance(value, str):
|
| 25 |
return None
|
| 26 |
unknown = str.__new__(cls, value)
|
python/src/workos/radar/models/radar_standalone_assess_request.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.radar_standalone_assess_request_action import (
|
| 10 |
RadarStandaloneAssessRequestAction,
|
|
@@ -24,15 +25,15 @@ class RadarStandaloneAssessRequest:
|
|
| 24 |
"""The user agent string of the request to assess."""
|
| 25 |
email: str
|
| 26 |
"""The email address of the user making the request."""
|
| 27 |
-
auth_method:
|
| 28 |
"""The authentication method being used."""
|
| 29 |
-
action:
|
| 30 |
"""The action being performed."""
|
| 31 |
-
signals_id:
|
| 32 |
"""An optional Radar signals ID for the request."""
|
| 33 |
|
| 34 |
@classmethod
|
| 35 |
-
def from_dict(cls, data:
|
| 36 |
"""Deserialize from a dictionary."""
|
| 37 |
try:
|
| 38 |
return cls(
|
|
@@ -46,9 +47,9 @@ class RadarStandaloneAssessRequest:
|
|
| 46 |
except (KeyError, ValueError) as e:
|
| 47 |
_raise_deserialize_error("RadarStandaloneAssessRequest", e)
|
| 48 |
|
| 49 |
-
def to_dict(self) ->
|
| 50 |
"""Serialize to a dictionary."""
|
| 51 |
-
result:
|
| 52 |
result["ip_address"] = self.ip_address
|
| 53 |
result["user_agent"] = self.user_agent
|
| 54 |
result["email"] = self.email
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.radar_standalone_assess_request_action import (
|
| 11 |
RadarStandaloneAssessRequestAction,
|
|
|
|
| 25 |
"""The user agent string of the request to assess."""
|
| 26 |
email: str
|
| 27 |
"""The email address of the user making the request."""
|
| 28 |
+
auth_method: RadarStandaloneAssessRequestAuthMethod
|
| 29 |
"""The authentication method being used."""
|
| 30 |
+
action: RadarStandaloneAssessRequestAction
|
| 31 |
"""The action being performed."""
|
| 32 |
+
signals_id: str | None = None
|
| 33 |
"""An optional Radar signals ID for the request."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> RadarStandaloneAssessRequest:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 47 |
except (KeyError, ValueError) as e:
|
| 48 |
_raise_deserialize_error("RadarStandaloneAssessRequest", e)
|
| 49 |
|
| 50 |
+
def to_dict(self) -> dict[str, Any]:
|
| 51 |
"""Serialize to a dictionary."""
|
| 52 |
+
result: dict[str, Any] = {}
|
| 53 |
result["ip_address"] = self.ip_address
|
| 54 |
result["user_agent"] = self.user_agent
|
| 55 |
result["email"] = self.email
|
python/src/workos/radar/models/radar_standalone_delete_radar_list_entry_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -16,8 +17,8 @@ class RadarStandaloneDeleteRadarListEntryRequest:
|
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
def from_dict(
|
| 19 |
-
cls, data:
|
| 20 |
-
) ->
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -26,8 +27,8 @@ class RadarStandaloneDeleteRadarListEntryRequest:
|
|
| 26 |
except (KeyError, ValueError) as e:
|
| 27 |
_raise_deserialize_error("RadarStandaloneDeleteRadarListEntryRequest", e)
|
| 28 |
|
| 29 |
-
def to_dict(self) ->
|
| 30 |
"""Serialize to a dictionary."""
|
| 31 |
-
result:
|
| 32 |
result["entry"] = self.entry
|
| 33 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
def from_dict(
|
| 20 |
+
cls, data: dict[str, Any]
|
| 21 |
+
) -> RadarStandaloneDeleteRadarListEntryRequest:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("RadarStandaloneDeleteRadarListEntryRequest", e)
|
| 29 |
|
| 30 |
+
def to_dict(self) -> dict[str, Any]:
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
+
result: dict[str, Any] = {}
|
| 33 |
result["entry"] = self.entry
|
| 34 |
return result
|
python/src/workos/radar/models/radar_standalone_response.py|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import Any
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.radar_standalone_response_blocklist_type import (
|
| 10 |
RadarStandaloneResponseBlocklistType,
|
|
@@ -21,19 +22,19 @@ from workos.common.models.radar_standalone_response_verdict import (
|
|
| 21 |
class RadarStandaloneResponse:
|
| 22 |
"""Radar Standalone Response model."""
|
| 23 |
|
| 24 |
-
verdict:
|
| 25 |
"""The verdict of the risk assessment."""
|
| 26 |
reason: str
|
| 27 |
"""A human-readable reason for the verdict."""
|
| 28 |
attempt_id: str
|
| 29 |
"""Unique identifier of the authentication attempt."""
|
| 30 |
-
control:
|
| 31 |
"""The Radar control that triggered the verdict. Only present if the verdict is `block` or `challenge`."""
|
| 32 |
-
blocklist_type:
|
| 33 |
"""The type of blocklist entry that triggered the verdict. Only present if the control is `restriction`."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -50,9 +51,9 @@ class RadarStandaloneResponse:
|
|
| 50 |
except (KeyError, ValueError) as e:
|
| 51 |
_raise_deserialize_error("RadarStandaloneResponse", e)
|
| 52 |
|
| 53 |
-
def to_dict(self) ->
|
| 54 |
"""Serialize to a dictionary."""
|
| 55 |
-
result:
|
| 56 |
result["verdict"] = (
|
| 57 |
self.verdict.value if isinstance(self.verdict, Enum) else self.verdict
|
| 58 |
)
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.radar_standalone_response_blocklist_type import (
|
| 11 |
RadarStandaloneResponseBlocklistType,
|
|
|
|
| 22 |
class RadarStandaloneResponse:
|
| 23 |
"""Radar Standalone Response model."""
|
| 24 |
|
| 25 |
+
verdict: RadarStandaloneResponseVerdict
|
| 26 |
"""The verdict of the risk assessment."""
|
| 27 |
reason: str
|
| 28 |
"""A human-readable reason for the verdict."""
|
| 29 |
attempt_id: str
|
| 30 |
"""Unique identifier of the authentication attempt."""
|
| 31 |
+
control: RadarStandaloneResponseControl | None = None
|
| 32 |
"""The Radar control that triggered the verdict. Only present if the verdict is `block` or `challenge`."""
|
| 33 |
+
blocklist_type: RadarStandaloneResponseBlocklistType | None = None
|
| 34 |
"""The type of blocklist entry that triggered the verdict. Only present if the control is `restriction`."""
|
| 35 |
|
| 36 |
@classmethod
|
| 37 |
+
def from_dict(cls, data: dict[str, Any]) -> RadarStandaloneResponse:
|
| 38 |
"""Deserialize from a dictionary."""
|
| 39 |
try:
|
| 40 |
return cls(
|
|
|
|
| 51 |
except (KeyError, ValueError) as e:
|
| 52 |
_raise_deserialize_error("RadarStandaloneResponse", e)
|
| 53 |
|
| 54 |
+
def to_dict(self) -> dict[str, Any]:
|
| 55 |
"""Serialize to a dictionary."""
|
| 56 |
+
result: dict[str, Any] = {}
|
| 57 |
result["verdict"] = (
|
| 58 |
self.verdict.value if isinstance(self.verdict, Enum) else self.verdict
|
| 59 |
)
|
python/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any,
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,15 +12,15 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class RadarStandaloneUpdateRadarAttemptRequest:
|
| 12 |
"""Radar Standalone Update Radar Attempt Request model."""
|
| 13 |
|
| 14 |
-
challenge_status:
|
| 15 |
"""Set to `"success"` to mark the challenge as completed."""
|
| 16 |
-
attempt_status:
|
| 17 |
"""Set to `"success"` to mark the authentication attempt as successful."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
def from_dict(
|
| 21 |
-
cls, data:
|
| 22 |
-
) ->
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -29,9 +30,9 @@ class RadarStandaloneUpdateRadarAttemptRequest:
|
|
| 29 |
except (KeyError, ValueError) as e:
|
| 30 |
_raise_deserialize_error("RadarStandaloneUpdateRadarAttemptRequest", e)
|
| 31 |
|
| 32 |
-
def to_dict(self) ->
|
| 33 |
"""Serialize to a dictionary."""
|
| 34 |
-
result:
|
| 35 |
if self.challenge_status is not None:
|
| 36 |
result["challenge_status"] = self.challenge_status
|
| 37 |
if self.attempt_status is not None:
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, Literal
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class RadarStandaloneUpdateRadarAttemptRequest:
|
| 13 |
"""Radar Standalone Update Radar Attempt Request model."""
|
| 14 |
|
| 15 |
+
challenge_status: Literal["success"] | None = None
|
| 16 |
"""Set to `"success"` to mark the challenge as completed."""
|
| 17 |
+
attempt_status: Literal["success"] | None = None
|
| 18 |
"""Set to `"success"` to mark the authentication attempt as successful."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
def from_dict(
|
| 22 |
+
cls, data: dict[str, Any]
|
| 23 |
+
) -> RadarStandaloneUpdateRadarAttemptRequest:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("RadarStandaloneUpdateRadarAttemptRequest", e)
|
| 32 |
|
| 33 |
+
def to_dict(self) -> dict[str, Any]:
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
+
result: dict[str, Any] = {}
|
| 36 |
if self.challenge_status is not None:
|
| 37 |
result["challenge_status"] = self.challenge_status
|
| 38 |
if self.attempt_status is not None:
|
python/src/workos/radar/models/radar_standalone_update_radar_list_request.py|
@@ -1,6 +1,7 @@
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
|
|
|
| 4 |
from .radar_standalone_delete_radar_list_entry_request import (
|
| 5 |
RadarStandaloneDeleteRadarListEntryRequest,
|
| 6 |
)
|
|
|
|
| 1 |
# This file is auto-generated by oagen. Do not edit.
|
| 2 |
|
| 3 |
from typing import TypeAlias
|
| 4 |
+
|
| 5 |
from .radar_standalone_delete_radar_list_entry_request import (
|
| 6 |
RadarStandaloneDeleteRadarListEntryRequest,
|
| 7 |
)
|
python/src/workos/sso/models/connections_connection_type.py|
@@ -32,6 +32,8 @@ class ConnectionsConnectionType(str, Enum):
|
|
| 32 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 33 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 34 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 35 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 36 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 37 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -92,6 +94,8 @@ ConnectionsConnectionTypeLiteral: TypeAlias = Literal[
|
|
| 92 |
"GoogleOAuth",
|
| 93 |
"GoogleOIDC",
|
| 94 |
"GoogleSAML",
|
|
|
|
|
|
|
| 95 |
"IntuitOAuth",
|
| 96 |
"JumpCloudSAML",
|
| 97 |
"KeycloakSAML",
|
|
|
|
| 32 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 33 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 34 |
GOOGLE_SAML = "GoogleSAML"
|
| 35 |
+
GROK_OAUTH = "GrokOAuth"
|
| 36 |
+
XO_AUTH = "XOAuth"
|
| 37 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 38 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 39 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 94 |
"GoogleOAuth",
|
| 95 |
"GoogleOIDC",
|
| 96 |
"GoogleSAML",
|
| 97 |
+
"GrokOAuth",
|
| 98 |
+
"XOAuth",
|
| 99 |
"IntuitOAuth",
|
| 100 |
"JumpCloudSAML",
|
| 101 |
"KeycloakSAML",
|
python/src/workos/user_management/_resource.py|
@@ -508,8 +508,8 @@ class UserManagement:
|
|
| 508 |
self,
|
| 509 |
*,
|
| 510 |
code: str,
|
| 511 |
-
verification_id: str,
|
| 512 |
-
phone_number: str,
|
| 513 |
pending_authentication_token: str,
|
| 514 |
ip_address: str | None = None,
|
| 515 |
device_id: str | None = None,
|
|
@@ -520,14 +520,16 @@ class UserManagement:
|
|
| 520 |
body: dict[str, Any] = {
|
| 521 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 522 |
"code": code,
|
| 523 |
-
"verification_id": verification_id,
|
| 524 |
-
"phone_number": phone_number,
|
| 525 |
"pending_authentication_token": pending_authentication_token,
|
| 526 |
}
|
| 527 |
if self._client.client_id is not None:
|
| 528 |
body["client_id"] = self._client.client_id
|
| 529 |
if self._client._api_key is not None:
|
| 530 |
body["client_secret"] = self._client._api_key
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
if ip_address is not None:
|
| 532 |
body["ip_address"] = ip_address
|
| 533 |
if device_id is not None:
|
|
@@ -2865,8 +2867,8 @@ class AsyncUserManagement:
|
|
| 2865 |
self,
|
| 2866 |
*,
|
| 2867 |
code: str,
|
| 2868 |
-
verification_id: str,
|
| 2869 |
-
phone_number: str,
|
| 2870 |
pending_authentication_token: str,
|
| 2871 |
ip_address: str | None = None,
|
| 2872 |
device_id: str | None = None,
|
|
@@ -2877,14 +2879,16 @@ class AsyncUserManagement:
|
|
| 2877 |
body: dict[str, Any] = {
|
| 2878 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 2879 |
"code": code,
|
| 2880 |
-
"verification_id": verification_id,
|
| 2881 |
-
"phone_number": phone_number,
|
| 2882 |
"pending_authentication_token": pending_authentication_token,
|
| 2883 |
}
|
| 2884 |
if self._client.client_id is not None:
|
| 2885 |
body["client_id"] = self._client.client_id
|
| 2886 |
if self._client._api_key is not None:
|
| 2887 |
body["client_secret"] = self._client._api_key
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2888 |
if ip_address is not None:
|
| 2889 |
body["ip_address"] = ip_address
|
| 2890 |
if device_id is not None:
|
|
|
|
| 508 |
self,
|
| 509 |
*,
|
| 510 |
code: str,
|
| 511 |
+
verification_id: str | None = None,
|
| 512 |
+
phone_number: str | None = None,
|
| 513 |
pending_authentication_token: str,
|
| 514 |
ip_address: str | None = None,
|
| 515 |
device_id: str | None = None,
|
|
|
|
| 520 |
body: dict[str, Any] = {
|
| 521 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 522 |
"code": code,
|
|
|
|
|
|
|
| 523 |
"pending_authentication_token": pending_authentication_token,
|
| 524 |
}
|
| 525 |
if self._client.client_id is not None:
|
| 526 |
body["client_id"] = self._client.client_id
|
| 527 |
if self._client._api_key is not None:
|
| 528 |
body["client_secret"] = self._client._api_key
|
| 529 |
+
if verification_id is not None:
|
| 530 |
+
body["verification_id"] = verification_id
|
| 531 |
+
if phone_number is not None:
|
| 532 |
+
body["phone_number"] = phone_number
|
| 533 |
if ip_address is not None:
|
| 534 |
body["ip_address"] = ip_address
|
| 535 |
if device_id is not None:
|
|
|
|
| 2867 |
self,
|
| 2868 |
*,
|
| 2869 |
code: str,
|
| 2870 |
+
verification_id: str | None = None,
|
| 2871 |
+
phone_number: str | None = None,
|
| 2872 |
pending_authentication_token: str,
|
| 2873 |
ip_address: str | None = None,
|
| 2874 |
device_id: str | None = None,
|
|
|
|
| 2879 |
body: dict[str, Any] = {
|
| 2880 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 2881 |
"code": code,
|
|
|
|
|
|
|
| 2882 |
"pending_authentication_token": pending_authentication_token,
|
| 2883 |
}
|
| 2884 |
if self._client.client_id is not None:
|
| 2885 |
body["client_id"] = self._client.client_id
|
| 2886 |
if self._client._api_key is not None:
|
| 2887 |
body["client_secret"] = self._client._api_key
|
| 2888 |
+
if verification_id is not None:
|
| 2889 |
+
body["verification_id"] = verification_id
|
| 2890 |
+
if phone_number is not None:
|
| 2891 |
+
body["phone_number"] = phone_number
|
| 2892 |
if ip_address is not None:
|
| 2893 |
body["ip_address"] = ip_address
|
| 2894 |
if device_id is not None:
|
python/src/workos/user_management/models/radar_sms_challenge_code_session_authenticate_request.py|
@@ -19,12 +19,12 @@ class RadarSmsChallengeCodeSessionAuthenticateRequest:
|
|
| 19 |
grant_type: Literal["urn:workos:oauth:grant-type:radar-sms-challenge:code"]
|
| 20 |
code: str
|
| 21 |
"""The one-time code from the Radar SMS challenge."""
|
| 22 |
-
verification_id: str
|
| 23 |
-
"""The ID of the Radar SMS verification being confirmed."""
|
| 24 |
-
phone_number: str
|
| 25 |
-
"""The phone number the Radar SMS challenge was sent to."""
|
| 26 |
pending_authentication_token: str
|
| 27 |
"""The pending authentication token from a previous authentication attempt."""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
ip_address: str | None = None
|
| 29 |
"""The IP address of the user's request."""
|
| 30 |
device_id: str | None = None
|
|
@@ -45,9 +45,9 @@ class RadarSmsChallengeCodeSessionAuthenticateRequest:
|
|
| 45 |
"grant_type", "urn:workos:oauth:grant-type:radar-sms-challenge:code"
|
| 46 |
),
|
| 47 |
code=data["code"],
|
| 48 |
-
verification_id=data["verification_id"],
|
| 49 |
-
phone_number=data["phone_number"],
|
| 50 |
pending_authentication_token=data["pending_authentication_token"],
|
|
|
|
|
|
|
| 51 |
ip_address=data.get("ip_address"),
|
| 52 |
device_id=data.get("device_id"),
|
| 53 |
user_agent=data.get("user_agent"),
|
|
@@ -64,9 +64,11 @@ class RadarSmsChallengeCodeSessionAuthenticateRequest:
|
|
| 64 |
result["client_secret"] = self.client_secret
|
| 65 |
result["grant_type"] = self.grant_type
|
| 66 |
result["code"] = self.code
|
| 67 |
-
result["verification_id"] = self.verification_id
|
| 68 |
-
result["phone_number"] = self.phone_number
|
| 69 |
result["pending_authentication_token"] = self.pending_authentication_token
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
if self.ip_address is not None:
|
| 71 |
result["ip_address"] = self.ip_address
|
| 72 |
if self.device_id is not None:
|
|
|
|
| 19 |
grant_type: Literal["urn:workos:oauth:grant-type:radar-sms-challenge:code"]
|
| 20 |
code: str
|
| 21 |
"""The one-time code from the Radar SMS challenge."""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
pending_authentication_token: str
|
| 23 |
"""The pending authentication token from a previous authentication attempt."""
|
| 24 |
+
verification_id: str | None = None
|
| 25 |
+
"""The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side."""
|
| 26 |
+
phone_number: str | None = None
|
| 27 |
+
"""The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side."""
|
| 28 |
ip_address: str | None = None
|
| 29 |
"""The IP address of the user's request."""
|
| 30 |
device_id: str | None = None
|
|
|
|
| 45 |
"grant_type", "urn:workos:oauth:grant-type:radar-sms-challenge:code"
|
| 46 |
),
|
| 47 |
code=data["code"],
|
|
|
|
|
|
|
| 48 |
pending_authentication_token=data["pending_authentication_token"],
|
| 49 |
+
verification_id=data.get("verification_id"),
|
| 50 |
+
phone_number=data.get("phone_number"),
|
| 51 |
ip_address=data.get("ip_address"),
|
| 52 |
device_id=data.get("device_id"),
|
| 53 |
user_agent=data.get("user_agent"),
|
|
|
|
| 64 |
result["client_secret"] = self.client_secret
|
| 65 |
result["grant_type"] = self.grant_type
|
| 66 |
result["code"] = self.code
|
|
|
|
|
|
|
| 67 |
result["pending_authentication_token"] = self.pending_authentication_token
|
| 68 |
+
if self.verification_id is not None:
|
| 69 |
+
result["verification_id"] = self.verification_id
|
| 70 |
+
if self.phone_number is not None:
|
| 71 |
+
result["phone_number"] = self.phone_number
|
| 72 |
if self.ip_address is not None:
|
| 73 |
result["ip_address"] = self.ip_address
|
| 74 |
if self.device_id is not None:
|
python/src/workos/vault/_resource.py|
@@ -2,12 +2,21 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
-
from .._types import
|
| 11 |
from .models import (
|
| 12 |
CreateDataKeyResponse,
|
| 13 |
DecryptResponse,
|
|
@@ -15,19 +24,10 @@ from .models import (
|
|
| 15 |
ObjectSummary,
|
| 16 |
ObjectWithoutValue,
|
| 17 |
VaultObject,
|
|
|
|
| 18 |
VersionListResponse,
|
| 19 |
)
|
| 20 |
-
from .models import VaultOrder
|
| 21 |
-
from .._pagination import AsyncPage, SyncPage
|
| 22 |
-
|
| 23 |
-
# @oagen-ignore-start โ client-side AES-GCM imports (hand-maintained)
|
| 24 |
-
import base64
|
| 25 |
-
import os
|
| 26 |
-
from dataclasses import dataclass
|
| 27 |
-
from typing import Tuple
|
| 28 |
|
| 29 |
-
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
| 30 |
-
from cryptography.hazmat.backends import default_backend
|
| 31 |
# @oagen-ignore-end
|
| 32 |
|
| 33 |
# @oagen-ignore-start โ client-side AES-GCM helpers (hand-maintained)
|
|
@@ -42,8 +42,8 @@ class DecodedKeys:
|
|
| 42 |
|
| 43 |
|
| 44 |
def _aes_gcm_encrypt(
|
| 45 |
-
plaintext: bytes, key: bytes, iv: bytes, aad:
|
| 46 |
-
) ->
|
| 47 |
encryptor = Cipher(
|
| 48 |
algorithms.AES(key), modes.GCM(iv), backend=default_backend()
|
| 49 |
).encryptor()
|
|
@@ -58,7 +58,7 @@ def _aes_gcm_decrypt(
|
|
| 58 |
key: bytes,
|
| 59 |
iv: bytes,
|
| 60 |
tag: bytes,
|
| 61 |
-
aad:
|
| 62 |
) -> bytes:
|
| 63 |
decryptor = Cipher(
|
| 64 |
algorithms.AES(key), modes.GCM(iv, tag), backend=default_backend()
|
|
@@ -83,7 +83,7 @@ def _encode_u32_leb128(value: int) -> bytes:
|
|
| 83 |
return bytes(encoded)
|
| 84 |
|
| 85 |
|
| 86 |
-
def _decode_u32_leb128(buf: bytes) ->
|
| 87 |
res = 0
|
| 88 |
bit = 0
|
| 89 |
for i, b in enumerate(buf):
|
|
@@ -119,14 +119,14 @@ def _decode_encrypted_payload(encrypted_data_b64: str) -> DecodedKeys:
|
|
| 119 |
class Vault:
|
| 120 |
"""Vault API resources."""
|
| 121 |
|
| 122 |
-
def __init__(self, client:
|
| 123 |
self._client = client
|
| 124 |
|
| 125 |
def create_data_key(
|
| 126 |
self,
|
| 127 |
*,
|
| 128 |
-
context:
|
| 129 |
-
request_options:
|
| 130 |
) -> CreateDataKeyResponse:
|
| 131 |
"""Create a data key
|
| 132 |
|
|
@@ -146,7 +146,7 @@ class Vault:
|
|
| 146 |
RateLimitExceededError: If rate limited (429).
|
| 147 |
ServerError: If the server returns a 5xx error.
|
| 148 |
"""
|
| 149 |
-
body:
|
| 150 |
"context": context,
|
| 151 |
}
|
| 152 |
return self._client.request(
|
|
@@ -161,7 +161,7 @@ class Vault:
|
|
| 161 |
self,
|
| 162 |
*,
|
| 163 |
keys: str,
|
| 164 |
-
request_options:
|
| 165 |
) -> DecryptResponse:
|
| 166 |
"""Decrypt a data key
|
| 167 |
|
|
@@ -180,7 +180,7 @@ class Vault:
|
|
| 180 |
RateLimitExceededError: If rate limited (429).
|
| 181 |
ServerError: If the server returns a 5xx error.
|
| 182 |
"""
|
| 183 |
-
body:
|
| 184 |
"keys": keys,
|
| 185 |
}
|
| 186 |
return self._client.request(
|
|
@@ -194,9 +194,9 @@ class Vault:
|
|
| 194 |
def create_rekey(
|
| 195 |
self,
|
| 196 |
*,
|
| 197 |
-
context:
|
| 198 |
encrypted_keys: str,
|
| 199 |
-
request_options:
|
| 200 |
) -> CreateDataKeyResponse:
|
| 201 |
"""Re-encrypt a data key
|
| 202 |
|
|
@@ -217,7 +217,7 @@ class Vault:
|
|
| 217 |
RateLimitExceededError: If rate limited (429).
|
| 218 |
ServerError: If the server returns a 5xx error.
|
| 219 |
"""
|
| 220 |
-
body:
|
| 221 |
"context": context,
|
| 222 |
"encrypted_keys": encrypted_keys,
|
| 223 |
}
|
|
@@ -232,13 +232,13 @@ class Vault:
|
|
| 232 |
def list_kv(
|
| 233 |
self,
|
| 234 |
*,
|
| 235 |
-
limit:
|
| 236 |
-
before:
|
| 237 |
-
after:
|
| 238 |
-
order:
|
| 239 |
-
search:
|
| 240 |
-
updated_after:
|
| 241 |
-
request_options:
|
| 242 |
) -> SyncPage[ObjectSummary]:
|
| 243 |
"""List objects
|
| 244 |
|
|
@@ -285,10 +285,10 @@ class Vault:
|
|
| 285 |
def create_kv(
|
| 286 |
self,
|
| 287 |
*,
|
| 288 |
-
key_context:
|
| 289 |
name: str,
|
| 290 |
value: str,
|
| 291 |
-
request_options:
|
| 292 |
) -> ObjectMetadata:
|
| 293 |
"""Create an object
|
| 294 |
|
|
@@ -311,7 +311,7 @@ class Vault:
|
|
| 311 |
RateLimitExceededError: If rate limited (429).
|
| 312 |
ServerError: If the server returns a 5xx error.
|
| 313 |
"""
|
| 314 |
-
body:
|
| 315 |
"key_context": key_context,
|
| 316 |
"name": name,
|
| 317 |
"value": value,
|
|
@@ -328,7 +328,7 @@ class Vault:
|
|
| 328 |
self,
|
| 329 |
name: str,
|
| 330 |
*,
|
| 331 |
-
request_options:
|
| 332 |
) -> VaultObject:
|
| 333 |
"""Read an object by name
|
| 334 |
|
|
@@ -359,7 +359,7 @@ class Vault:
|
|
| 359 |
self,
|
| 360 |
id: str,
|
| 361 |
*,
|
| 362 |
-
request_options:
|
| 363 |
) -> VaultObject:
|
| 364 |
"""Read an object by ID
|
| 365 |
|
|
@@ -391,8 +391,8 @@ class Vault:
|
|
| 391 |
id: str,
|
| 392 |
*,
|
| 393 |
value: str,
|
| 394 |
-
version_check:
|
| 395 |
-
request_options:
|
| 396 |
) -> ObjectWithoutValue:
|
| 397 |
"""Update an object
|
| 398 |
|
|
@@ -414,7 +414,7 @@ class Vault:
|
|
| 414 |
RateLimitExceededError: If rate limited (429).
|
| 415 |
ServerError: If the server returns a 5xx error.
|
| 416 |
"""
|
| 417 |
-
body:
|
| 418 |
"value": value,
|
| 419 |
}
|
| 420 |
if not isinstance(version_check, NotGiven):
|
|
@@ -431,8 +431,8 @@ class Vault:
|
|
| 431 |
self,
|
| 432 |
id: str,
|
| 433 |
*,
|
| 434 |
-
version_check:
|
| 435 |
-
request_options:
|
| 436 |
) -> None:
|
| 437 |
"""Delete an object
|
| 438 |
|
|
@@ -450,7 +450,7 @@ class Vault:
|
|
| 450 |
RateLimitExceededError: If rate limited (429).
|
| 451 |
ServerError: If the server returns a 5xx error.
|
| 452 |
"""
|
| 453 |
-
params:
|
| 454 |
k: v
|
| 455 |
for k, v in {
|
| 456 |
"version_check": version_check,
|
|
@@ -468,7 +468,7 @@ class Vault:
|
|
| 468 |
self,
|
| 469 |
id: str,
|
| 470 |
*,
|
| 471 |
-
request_options:
|
| 472 |
) -> ObjectWithoutValue:
|
| 473 |
"""Describe an object
|
| 474 |
|
|
@@ -499,7 +499,7 @@ class Vault:
|
|
| 499 |
self,
|
| 500 |
id: str,
|
| 501 |
*,
|
| 502 |
-
request_options:
|
| 503 |
) -> VersionListResponse:
|
| 504 |
"""List object versions
|
| 505 |
|
|
@@ -532,8 +532,8 @@ class Vault:
|
|
| 532 |
self,
|
| 533 |
*,
|
| 534 |
data: str,
|
| 535 |
-
key_context:
|
| 536 |
-
associated_data:
|
| 537 |
) -> str:
|
| 538 |
"""Encrypt data locally using AES-GCM with a data key derived from the context."""
|
| 539 |
key_pair = self.create_data_key(context=key_context)
|
|
@@ -556,7 +556,7 @@ class Vault:
|
|
| 556 |
return base64.b64encode(combined).decode("utf-8")
|
| 557 |
|
| 558 |
def decrypt(
|
| 559 |
-
self, *, encrypted_data: str, associated_data:
|
| 560 |
) -> str:
|
| 561 |
"""Decrypt data that was previously encrypted using the encrypt method."""
|
| 562 |
decoded = _decode_encrypted_payload(encrypted_data)
|
|
@@ -580,14 +580,14 @@ class Vault:
|
|
| 580 |
class AsyncVault:
|
| 581 |
"""Vault API resources (async)."""
|
| 582 |
|
| 583 |
-
def __init__(self, client:
|
| 584 |
self._client = client
|
| 585 |
|
| 586 |
async def create_data_key(
|
| 587 |
self,
|
| 588 |
*,
|
| 589 |
-
context:
|
| 590 |
-
request_options:
|
| 591 |
) -> CreateDataKeyResponse:
|
| 592 |
"""Create a data key
|
| 593 |
|
|
@@ -607,7 +607,7 @@ class AsyncVault:
|
|
| 607 |
RateLimitExceededError: If rate limited (429).
|
| 608 |
ServerError: If the server returns a 5xx error.
|
| 609 |
"""
|
| 610 |
-
body:
|
| 611 |
"context": context,
|
| 612 |
}
|
| 613 |
return await self._client.request(
|
|
@@ -622,7 +622,7 @@ class AsyncVault:
|
|
| 622 |
self,
|
| 623 |
*,
|
| 624 |
keys: str,
|
| 625 |
-
request_options:
|
| 626 |
) -> DecryptResponse:
|
| 627 |
"""Decrypt a data key
|
| 628 |
|
|
@@ -641,7 +641,7 @@ class AsyncVault:
|
|
| 641 |
RateLimitExceededError: If rate limited (429).
|
| 642 |
ServerError: If the server returns a 5xx error.
|
| 643 |
"""
|
| 644 |
-
body:
|
| 645 |
"keys": keys,
|
| 646 |
}
|
| 647 |
return await self._client.request(
|
|
@@ -655,9 +655,9 @@ class AsyncVault:
|
|
| 655 |
async def create_rekey(
|
| 656 |
self,
|
| 657 |
*,
|
| 658 |
-
context:
|
| 659 |
encrypted_keys: str,
|
| 660 |
-
request_options:
|
| 661 |
) -> CreateDataKeyResponse:
|
| 662 |
"""Re-encrypt a data key
|
| 663 |
|
|
@@ -678,7 +678,7 @@ class AsyncVault:
|
|
| 678 |
RateLimitExceededError: If rate limited (429).
|
| 679 |
ServerError: If the server returns a 5xx error.
|
| 680 |
"""
|
| 681 |
-
body:
|
| 682 |
"context": context,
|
| 683 |
"encrypted_keys": encrypted_keys,
|
| 684 |
}
|
|
@@ -693,13 +693,13 @@ class AsyncVault:
|
|
| 693 |
async def list_kv(
|
| 694 |
self,
|
| 695 |
*,
|
| 696 |
-
limit:
|
| 697 |
-
before:
|
| 698 |
-
after:
|
| 699 |
-
order:
|
| 700 |
-
search:
|
| 701 |
-
updated_after:
|
| 702 |
-
request_options:
|
| 703 |
) -> AsyncPage[ObjectSummary]:
|
| 704 |
"""List objects
|
| 705 |
|
|
@@ -746,10 +746,10 @@ class AsyncVault:
|
|
| 746 |
async def create_kv(
|
| 747 |
self,
|
| 748 |
*,
|
| 749 |
-
key_context:
|
| 750 |
name: str,
|
| 751 |
value: str,
|
| 752 |
-
request_options:
|
| 753 |
) -> ObjectMetadata:
|
| 754 |
"""Create an object
|
| 755 |
|
|
@@ -772,7 +772,7 @@ class AsyncVault:
|
|
| 772 |
RateLimitExceededError: If rate limited (429).
|
| 773 |
ServerError: If the server returns a 5xx error.
|
| 774 |
"""
|
| 775 |
-
body:
|
| 776 |
"key_context": key_context,
|
| 777 |
"name": name,
|
| 778 |
"value": value,
|
|
@@ -789,7 +789,7 @@ class AsyncVault:
|
|
| 789 |
self,
|
| 790 |
name: str,
|
| 791 |
*,
|
| 792 |
-
request_options:
|
| 793 |
) -> VaultObject:
|
| 794 |
"""Read an object by name
|
| 795 |
|
|
@@ -820,7 +820,7 @@ class AsyncVault:
|
|
| 820 |
self,
|
| 821 |
id: str,
|
| 822 |
*,
|
| 823 |
-
request_options:
|
| 824 |
) -> VaultObject:
|
| 825 |
"""Read an object by ID
|
| 826 |
|
|
@@ -852,8 +852,8 @@ class AsyncVault:
|
|
| 852 |
id: str,
|
| 853 |
*,
|
| 854 |
value: str,
|
| 855 |
-
version_check:
|
| 856 |
-
request_options:
|
| 857 |
) -> ObjectWithoutValue:
|
| 858 |
"""Update an object
|
| 859 |
|
|
@@ -875,7 +875,7 @@ class AsyncVault:
|
|
| 875 |
RateLimitExceededError: If rate limited (429).
|
| 876 |
ServerError: If the server returns a 5xx error.
|
| 877 |
"""
|
| 878 |
-
body:
|
| 879 |
"value": value,
|
| 880 |
}
|
| 881 |
if not isinstance(version_check, NotGiven):
|
|
@@ -892,8 +892,8 @@ class AsyncVault:
|
|
| 892 |
self,
|
| 893 |
id: str,
|
| 894 |
*,
|
| 895 |
-
version_check:
|
| 896 |
-
request_options:
|
| 897 |
) -> None:
|
| 898 |
"""Delete an object
|
| 899 |
|
|
@@ -911,7 +911,7 @@ class AsyncVault:
|
|
| 911 |
RateLimitExceededError: If rate limited (429).
|
| 912 |
ServerError: If the server returns a 5xx error.
|
| 913 |
"""
|
| 914 |
-
params:
|
| 915 |
k: v
|
| 916 |
for k, v in {
|
| 917 |
"version_check": version_check,
|
|
@@ -929,7 +929,7 @@ class AsyncVault:
|
|
| 929 |
self,
|
| 930 |
id: str,
|
| 931 |
*,
|
| 932 |
-
request_options:
|
| 933 |
) -> ObjectWithoutValue:
|
| 934 |
"""Describe an object
|
| 935 |
|
|
@@ -960,7 +960,7 @@ class AsyncVault:
|
|
| 960 |
self,
|
| 961 |
id: str,
|
| 962 |
*,
|
| 963 |
-
request_options:
|
| 964 |
) -> VersionListResponse:
|
| 965 |
"""List object versions
|
| 966 |
|
|
@@ -993,8 +993,8 @@ class AsyncVault:
|
|
| 993 |
self,
|
| 994 |
*,
|
| 995 |
data: str,
|
| 996 |
-
key_context:
|
| 997 |
-
associated_data:
|
| 998 |
) -> str:
|
| 999 |
"""Encrypt data locally using AES-GCM with a data key derived from the context."""
|
| 1000 |
key_pair = await self.create_data_key(context=key_context)
|
|
@@ -1016,7 +1016,7 @@ class AsyncVault:
|
|
| 1016 |
return base64.b64encode(combined).decode("utf-8")
|
| 1017 |
|
| 1018 |
async def decrypt(
|
| 1019 |
-
self, *, encrypted_data: str, associated_data:
|
| 1020 |
) -> str:
|
| 1021 |
"""Decrypt data that was previously encrypted using the encrypt method."""
|
| 1022 |
decoded = _decode_encrypted_payload(encrypted_data)
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
# @oagen-ignore-start โ client-side AES-GCM imports (hand-maintained)
|
| 11 |
+
import base64
|
| 12 |
+
import os
|
| 13 |
+
from dataclasses import dataclass
|
| 14 |
+
|
| 15 |
+
from cryptography.hazmat.backends import default_backend
|
| 16 |
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
| 17 |
+
|
| 18 |
+
from .._pagination import AsyncPage, SyncPage
|
| 19 |
+
from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value
|
| 20 |
from .models import (
|
| 21 |
CreateDataKeyResponse,
|
| 22 |
DecryptResponse,
|
|
|
|
| 24 |
ObjectSummary,
|
| 25 |
ObjectWithoutValue,
|
| 26 |
VaultObject,
|
| 27 |
+
VaultOrder,
|
| 28 |
VersionListResponse,
|
| 29 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
|
|
|
|
|
|
| 31 |
# @oagen-ignore-end
|
| 32 |
|
| 33 |
# @oagen-ignore-start โ client-side AES-GCM helpers (hand-maintained)
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def _aes_gcm_encrypt(
|
| 45 |
+
plaintext: bytes, key: bytes, iv: bytes, aad: bytes | None
|
| 46 |
+
) -> dict[str, bytes]:
|
| 47 |
encryptor = Cipher(
|
| 48 |
algorithms.AES(key), modes.GCM(iv), backend=default_backend()
|
| 49 |
).encryptor()
|
|
|
|
| 58 |
key: bytes,
|
| 59 |
iv: bytes,
|
| 60 |
tag: bytes,
|
| 61 |
+
aad: bytes | None = None,
|
| 62 |
) -> bytes:
|
| 63 |
decryptor = Cipher(
|
| 64 |
algorithms.AES(key), modes.GCM(iv, tag), backend=default_backend()
|
|
|
|
| 83 |
return bytes(encoded)
|
| 84 |
|
| 85 |
|
| 86 |
+
def _decode_u32_leb128(buf: bytes) -> tuple[int, int]:
|
| 87 |
res = 0
|
| 88 |
bit = 0
|
| 89 |
for i, b in enumerate(buf):
|
|
|
|
| 119 |
class Vault:
|
| 120 |
"""Vault API resources."""
|
| 121 |
|
| 122 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 123 |
self._client = client
|
| 124 |
|
| 125 |
def create_data_key(
|
| 126 |
self,
|
| 127 |
*,
|
| 128 |
+
context: dict[str, str],
|
| 129 |
+
request_options: RequestOptions | None = None,
|
| 130 |
) -> CreateDataKeyResponse:
|
| 131 |
"""Create a data key
|
| 132 |
|
|
|
|
| 146 |
RateLimitExceededError: If rate limited (429).
|
| 147 |
ServerError: If the server returns a 5xx error.
|
| 148 |
"""
|
| 149 |
+
body: dict[str, Any] = {
|
| 150 |
"context": context,
|
| 151 |
}
|
| 152 |
return self._client.request(
|
|
|
|
| 161 |
self,
|
| 162 |
*,
|
| 163 |
keys: str,
|
| 164 |
+
request_options: RequestOptions | None = None,
|
| 165 |
) -> DecryptResponse:
|
| 166 |
"""Decrypt a data key
|
| 167 |
|
|
|
|
| 180 |
RateLimitExceededError: If rate limited (429).
|
| 181 |
ServerError: If the server returns a 5xx error.
|
| 182 |
"""
|
| 183 |
+
body: dict[str, Any] = {
|
| 184 |
"keys": keys,
|
| 185 |
}
|
| 186 |
return self._client.request(
|
|
|
|
| 194 |
def create_rekey(
|
| 195 |
self,
|
| 196 |
*,
|
| 197 |
+
context: dict[str, str],
|
| 198 |
encrypted_keys: str,
|
| 199 |
+
request_options: RequestOptions | None = None,
|
| 200 |
) -> CreateDataKeyResponse:
|
| 201 |
"""Re-encrypt a data key
|
| 202 |
|
|
|
|
| 217 |
RateLimitExceededError: If rate limited (429).
|
| 218 |
ServerError: If the server returns a 5xx error.
|
| 219 |
"""
|
| 220 |
+
body: dict[str, Any] = {
|
| 221 |
"context": context,
|
| 222 |
"encrypted_keys": encrypted_keys,
|
| 223 |
}
|
|
|
|
| 232 |
def list_kv(
|
| 233 |
self,
|
| 234 |
*,
|
| 235 |
+
limit: int | None = None,
|
| 236 |
+
before: str | None = None,
|
| 237 |
+
after: str | None = None,
|
| 238 |
+
order: VaultOrder | str | None = None,
|
| 239 |
+
search: str | None = None,
|
| 240 |
+
updated_after: str | None = None,
|
| 241 |
+
request_options: RequestOptions | None = None,
|
| 242 |
) -> SyncPage[ObjectSummary]:
|
| 243 |
"""List objects
|
| 244 |
|
|
|
|
| 285 |
def create_kv(
|
| 286 |
self,
|
| 287 |
*,
|
| 288 |
+
key_context: dict[str, str],
|
| 289 |
name: str,
|
| 290 |
value: str,
|
| 291 |
+
request_options: RequestOptions | None = None,
|
| 292 |
) -> ObjectMetadata:
|
| 293 |
"""Create an object
|
| 294 |
|
|
|
|
| 311 |
RateLimitExceededError: If rate limited (429).
|
| 312 |
ServerError: If the server returns a 5xx error.
|
| 313 |
"""
|
| 314 |
+
body: dict[str, Any] = {
|
| 315 |
"key_context": key_context,
|
| 316 |
"name": name,
|
| 317 |
"value": value,
|
|
|
|
| 328 |
self,
|
| 329 |
name: str,
|
| 330 |
*,
|
| 331 |
+
request_options: RequestOptions | None = None,
|
| 332 |
) -> VaultObject:
|
| 333 |
"""Read an object by name
|
| 334 |
|
|
|
|
| 359 |
self,
|
| 360 |
id: str,
|
| 361 |
*,
|
| 362 |
+
request_options: RequestOptions | None = None,
|
| 363 |
) -> VaultObject:
|
| 364 |
"""Read an object by ID
|
| 365 |
|
|
|
|
| 391 |
id: str,
|
| 392 |
*,
|
| 393 |
value: str,
|
| 394 |
+
version_check: str | None | NotGiven = NOT_GIVEN,
|
| 395 |
+
request_options: RequestOptions | None = None,
|
| 396 |
) -> ObjectWithoutValue:
|
| 397 |
"""Update an object
|
| 398 |
|
|
|
|
| 414 |
RateLimitExceededError: If rate limited (429).
|
| 415 |
ServerError: If the server returns a 5xx error.
|
| 416 |
"""
|
| 417 |
+
body: dict[str, Any] = {
|
| 418 |
"value": value,
|
| 419 |
}
|
| 420 |
if not isinstance(version_check, NotGiven):
|
|
|
|
| 431 |
self,
|
| 432 |
id: str,
|
| 433 |
*,
|
| 434 |
+
version_check: str | None = None,
|
| 435 |
+
request_options: RequestOptions | None = None,
|
| 436 |
) -> None:
|
| 437 |
"""Delete an object
|
| 438 |
|
|
|
|
| 450 |
RateLimitExceededError: If rate limited (429).
|
| 451 |
ServerError: If the server returns a 5xx error.
|
| 452 |
"""
|
| 453 |
+
params: dict[str, Any] = {
|
| 454 |
k: v
|
| 455 |
for k, v in {
|
| 456 |
"version_check": version_check,
|
|
|
|
| 468 |
self,
|
| 469 |
id: str,
|
| 470 |
*,
|
| 471 |
+
request_options: RequestOptions | None = None,
|
| 472 |
) -> ObjectWithoutValue:
|
| 473 |
"""Describe an object
|
| 474 |
|
|
|
|
| 499 |
self,
|
| 500 |
id: str,
|
| 501 |
*,
|
| 502 |
+
request_options: RequestOptions | None = None,
|
| 503 |
) -> VersionListResponse:
|
| 504 |
"""List object versions
|
| 505 |
|
|
|
|
| 532 |
self,
|
| 533 |
*,
|
| 534 |
data: str,
|
| 535 |
+
key_context: dict[str, str],
|
| 536 |
+
associated_data: str | None = None,
|
| 537 |
) -> str:
|
| 538 |
"""Encrypt data locally using AES-GCM with a data key derived from the context."""
|
| 539 |
key_pair = self.create_data_key(context=key_context)
|
|
|
|
| 556 |
return base64.b64encode(combined).decode("utf-8")
|
| 557 |
|
| 558 |
def decrypt(
|
| 559 |
+
self, *, encrypted_data: str, associated_data: str | None = None
|
| 560 |
) -> str:
|
| 561 |
"""Decrypt data that was previously encrypted using the encrypt method."""
|
| 562 |
decoded = _decode_encrypted_payload(encrypted_data)
|
|
|
|
| 580 |
class AsyncVault:
|
| 581 |
"""Vault API resources (async)."""
|
| 582 |
|
| 583 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 584 |
self._client = client
|
| 585 |
|
| 586 |
async def create_data_key(
|
| 587 |
self,
|
| 588 |
*,
|
| 589 |
+
context: dict[str, str],
|
| 590 |
+
request_options: RequestOptions | None = None,
|
| 591 |
) -> CreateDataKeyResponse:
|
| 592 |
"""Create a data key
|
| 593 |
|
|
|
|
| 607 |
RateLimitExceededError: If rate limited (429).
|
| 608 |
ServerError: If the server returns a 5xx error.
|
| 609 |
"""
|
| 610 |
+
body: dict[str, Any] = {
|
| 611 |
"context": context,
|
| 612 |
}
|
| 613 |
return await self._client.request(
|
|
|
|
| 622 |
self,
|
| 623 |
*,
|
| 624 |
keys: str,
|
| 625 |
+
request_options: RequestOptions | None = None,
|
| 626 |
) -> DecryptResponse:
|
| 627 |
"""Decrypt a data key
|
| 628 |
|
|
|
|
| 641 |
RateLimitExceededError: If rate limited (429).
|
| 642 |
ServerError: If the server returns a 5xx error.
|
| 643 |
"""
|
| 644 |
+
body: dict[str, Any] = {
|
| 645 |
"keys": keys,
|
| 646 |
}
|
| 647 |
return await self._client.request(
|
|
|
|
| 655 |
async def create_rekey(
|
| 656 |
self,
|
| 657 |
*,
|
| 658 |
+
context: dict[str, str],
|
| 659 |
encrypted_keys: str,
|
| 660 |
+
request_options: RequestOptions | None = None,
|
| 661 |
) -> CreateDataKeyResponse:
|
| 662 |
"""Re-encrypt a data key
|
| 663 |
|
|
|
|
| 678 |
RateLimitExceededError: If rate limited (429).
|
| 679 |
ServerError: If the server returns a 5xx error.
|
| 680 |
"""
|
| 681 |
+
body: dict[str, Any] = {
|
| 682 |
"context": context,
|
| 683 |
"encrypted_keys": encrypted_keys,
|
| 684 |
}
|
|
|
|
| 693 |
async def list_kv(
|
| 694 |
self,
|
| 695 |
*,
|
| 696 |
+
limit: int | None = None,
|
| 697 |
+
before: str | None = None,
|
| 698 |
+
after: str | None = None,
|
| 699 |
+
order: VaultOrder | str | None = None,
|
| 700 |
+
search: str | None = None,
|
| 701 |
+
updated_after: str | None = None,
|
| 702 |
+
request_options: RequestOptions | None = None,
|
| 703 |
) -> AsyncPage[ObjectSummary]:
|
| 704 |
"""List objects
|
| 705 |
|
|
|
|
| 746 |
async def create_kv(
|
| 747 |
self,
|
| 748 |
*,
|
| 749 |
+
key_context: dict[str, str],
|
| 750 |
name: str,
|
| 751 |
value: str,
|
| 752 |
+
request_options: RequestOptions | None = None,
|
| 753 |
) -> ObjectMetadata:
|
| 754 |
"""Create an object
|
| 755 |
|
|
|
|
| 772 |
RateLimitExceededError: If rate limited (429).
|
| 773 |
ServerError: If the server returns a 5xx error.
|
| 774 |
"""
|
| 775 |
+
body: dict[str, Any] = {
|
| 776 |
"key_context": key_context,
|
| 777 |
"name": name,
|
| 778 |
"value": value,
|
|
|
|
| 789 |
self,
|
| 790 |
name: str,
|
| 791 |
*,
|
| 792 |
+
request_options: RequestOptions | None = None,
|
| 793 |
) -> VaultObject:
|
| 794 |
"""Read an object by name
|
| 795 |
|
|
|
|
| 820 |
self,
|
| 821 |
id: str,
|
| 822 |
*,
|
| 823 |
+
request_options: RequestOptions | None = None,
|
| 824 |
) -> VaultObject:
|
| 825 |
"""Read an object by ID
|
| 826 |
|
|
|
|
| 852 |
id: str,
|
| 853 |
*,
|
| 854 |
value: str,
|
| 855 |
+
version_check: str | None | NotGiven = NOT_GIVEN,
|
| 856 |
+
request_options: RequestOptions | None = None,
|
| 857 |
) -> ObjectWithoutValue:
|
| 858 |
"""Update an object
|
| 859 |
|
|
|
|
| 875 |
RateLimitExceededError: If rate limited (429).
|
| 876 |
ServerError: If the server returns a 5xx error.
|
| 877 |
"""
|
| 878 |
+
body: dict[str, Any] = {
|
| 879 |
"value": value,
|
| 880 |
}
|
| 881 |
if not isinstance(version_check, NotGiven):
|
|
|
|
| 892 |
self,
|
| 893 |
id: str,
|
| 894 |
*,
|
| 895 |
+
version_check: str | None = None,
|
| 896 |
+
request_options: RequestOptions | None = None,
|
| 897 |
) -> None:
|
| 898 |
"""Delete an object
|
| 899 |
|
|
|
|
| 911 |
RateLimitExceededError: If rate limited (429).
|
| 912 |
ServerError: If the server returns a 5xx error.
|
| 913 |
"""
|
| 914 |
+
params: dict[str, Any] = {
|
| 915 |
k: v
|
| 916 |
for k, v in {
|
| 917 |
"version_check": version_check,
|
|
|
|
| 929 |
self,
|
| 930 |
id: str,
|
| 931 |
*,
|
| 932 |
+
request_options: RequestOptions | None = None,
|
| 933 |
) -> ObjectWithoutValue:
|
| 934 |
"""Describe an object
|
| 935 |
|
|
|
|
| 960 |
self,
|
| 961 |
id: str,
|
| 962 |
*,
|
| 963 |
+
request_options: RequestOptions | None = None,
|
| 964 |
) -> VersionListResponse:
|
| 965 |
"""List object versions
|
| 966 |
|
|
|
|
| 993 |
self,
|
| 994 |
*,
|
| 995 |
data: str,
|
| 996 |
+
key_context: dict[str, str],
|
| 997 |
+
associated_data: str | None = None,
|
| 998 |
) -> str:
|
| 999 |
"""Encrypt data locally using AES-GCM with a data key derived from the context."""
|
| 1000 |
key_pair = await self.create_data_key(context=key_context)
|
|
|
|
| 1016 |
return base64.b64encode(combined).decode("utf-8")
|
| 1017 |
|
| 1018 |
async def decrypt(
|
| 1019 |
+
self, *, encrypted_data: str, associated_data: str | None = None
|
| 1020 |
) -> str:
|
| 1021 |
"""Decrypt data that was previously encrypted using the encrypt method."""
|
| 1022 |
decoded = _decode_encrypted_payload(encrypted_data)
|
python/src/workos/vault/models/create_data_key_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,11 +12,11 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class CreateDataKeyRequest:
|
| 12 |
"""Create Data Key Request model."""
|
| 13 |
|
| 14 |
-
context:
|
| 15 |
"""Map of values used to determine the encryption key."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class CreateDataKeyRequest:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("CreateDataKeyRequest", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["context"] = self.context
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class CreateDataKeyRequest:
|
| 13 |
"""Create Data Key Request model."""
|
| 14 |
|
| 15 |
+
context: dict[str, str]
|
| 16 |
"""Map of values used to determine the encryption key."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateDataKeyRequest:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("CreateDataKeyRequest", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["context"] = self.context
|
| 32 |
return result
|
python/src/workos/vault/models/create_data_key_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,7 +12,7 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class CreateDataKeyResponse:
|
| 12 |
"""Create Data Key Response model."""
|
| 13 |
|
| 14 |
-
context:
|
| 15 |
"""Map of values used to determine the encryption key."""
|
| 16 |
data_key: str
|
| 17 |
"""Base64-encoded data encryption key."""
|
|
@@ -21,7 +22,7 @@ class CreateDataKeyResponse:
|
|
| 21 |
"""Unique identifier for the generated data key."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -33,9 +34,9 @@ class CreateDataKeyResponse:
|
|
| 33 |
except (KeyError, ValueError) as e:
|
| 34 |
_raise_deserialize_error("CreateDataKeyResponse", e)
|
| 35 |
|
| 36 |
-
def to_dict(self) ->
|
| 37 |
"""Serialize to a dictionary."""
|
| 38 |
-
result:
|
| 39 |
result["context"] = self.context
|
| 40 |
result["data_key"] = self.data_key
|
| 41 |
result["encrypted_keys"] = self.encrypted_keys
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class CreateDataKeyResponse:
|
| 13 |
"""Create Data Key Response model."""
|
| 14 |
|
| 15 |
+
context: dict[str, str]
|
| 16 |
"""Map of values used to determine the encryption key."""
|
| 17 |
data_key: str
|
| 18 |
"""Base64-encoded data encryption key."""
|
|
|
|
| 22 |
"""Unique identifier for the generated data key."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateDataKeyResponse:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("CreateDataKeyResponse", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["context"] = self.context
|
| 41 |
result["data_key"] = self.data_key
|
| 42 |
result["encrypted_keys"] = self.encrypted_keys
|
python/src/workos/vault/models/create_object_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,7 +12,7 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class CreateObjectRequest:
|
| 12 |
"""Create Object Request model."""
|
| 13 |
|
| 14 |
-
key_context:
|
| 15 |
"""Map of values used to determine the encryption key."""
|
| 16 |
name: str
|
| 17 |
"""Unique name for the object."""
|
|
@@ -19,7 +20,7 @@ class CreateObjectRequest:
|
|
| 19 |
"""Plaintext data to encrypt and store."""
|
| 20 |
|
| 21 |
@classmethod
|
| 22 |
-
def from_dict(cls, data:
|
| 23 |
"""Deserialize from a dictionary."""
|
| 24 |
try:
|
| 25 |
return cls(
|
|
@@ -30,9 +31,9 @@ class CreateObjectRequest:
|
|
| 30 |
except (KeyError, ValueError) as e:
|
| 31 |
_raise_deserialize_error("CreateObjectRequest", e)
|
| 32 |
|
| 33 |
-
def to_dict(self) ->
|
| 34 |
"""Serialize to a dictionary."""
|
| 35 |
-
result:
|
| 36 |
result["key_context"] = self.key_context
|
| 37 |
result["name"] = self.name
|
| 38 |
result["value"] = self.value
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class CreateObjectRequest:
|
| 13 |
"""Create Object Request model."""
|
| 14 |
|
| 15 |
+
key_context: dict[str, str]
|
| 16 |
"""Map of values used to determine the encryption key."""
|
| 17 |
name: str
|
| 18 |
"""Unique name for the object."""
|
|
|
|
| 20 |
"""Plaintext data to encrypt and store."""
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateObjectRequest:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
|
|
|
| 31 |
except (KeyError, ValueError) as e:
|
| 32 |
_raise_deserialize_error("CreateObjectRequest", e)
|
| 33 |
|
| 34 |
+
def to_dict(self) -> dict[str, Any]:
|
| 35 |
"""Serialize to a dictionary."""
|
| 36 |
+
result: dict[str, Any] = {}
|
| 37 |
result["key_context"] = self.key_context
|
| 38 |
result["name"] = self.name
|
| 39 |
result["value"] = self.value
|
python/src/workos/vault/models/decrypt_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -15,7 +16,7 @@ class DecryptRequest:
|
|
| 15 |
"""Base64-encoded encrypted data key to decrypt."""
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
-
def from_dict(cls, data:
|
| 19 |
"""Deserialize from a dictionary."""
|
| 20 |
try:
|
| 21 |
return cls(
|
|
@@ -24,8 +25,8 @@ class DecryptRequest:
|
|
| 24 |
except (KeyError, ValueError) as e:
|
| 25 |
_raise_deserialize_error("DecryptRequest", e)
|
| 26 |
|
| 27 |
-
def to_dict(self) ->
|
| 28 |
"""Serialize to a dictionary."""
|
| 29 |
-
result:
|
| 30 |
result["keys"] = self.keys
|
| 31 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 16 |
"""Base64-encoded encrypted data key to decrypt."""
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
+
def from_dict(cls, data: dict[str, Any]) -> DecryptRequest:
|
| 20 |
"""Deserialize from a dictionary."""
|
| 21 |
try:
|
| 22 |
return cls(
|
|
|
|
| 25 |
except (KeyError, ValueError) as e:
|
| 26 |
_raise_deserialize_error("DecryptRequest", e)
|
| 27 |
|
| 28 |
+
def to_dict(self) -> dict[str, Any]:
|
| 29 |
"""Serialize to a dictionary."""
|
| 30 |
+
result: dict[str, Any] = {}
|
| 31 |
result["keys"] = self.keys
|
| 32 |
return result
|
python/src/workos/vault/models/decrypt_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class DecryptResponse:
|
|
| 17 |
"""Unique identifier of the decrypted data key."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class DecryptResponse:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("DecryptResponse", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["data_key"] = self.data_key
|
| 34 |
result["id"] = self.id
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""Unique identifier of the decrypted data key."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> DecryptResponse:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("DecryptResponse", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["data_key"] = self.data_key
|
| 35 |
result["id"] = self.id
|
| 36 |
return result
|
python/src/workos/vault/models/delete_object_response.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -17,7 +18,7 @@ class DeleteObjectResponse:
|
|
| 17 |
"""Whether the deletion succeeded."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class DeleteObjectResponse:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("DeleteObjectResponse", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["name"] = self.name
|
| 34 |
result["success"] = self.success
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 18 |
"""Whether the deletion succeeded."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> DeleteObjectResponse:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("DeleteObjectResponse", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["name"] = self.name
|
| 35 |
result["success"] = self.success
|
| 36 |
return result
|
python/src/workos/vault/models/object_summary.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -17,11 +17,11 @@ class ObjectSummary:
|
|
| 17 |
"""Unique identifier of the object."""
|
| 18 |
name: str
|
| 19 |
"""Unique name of the object."""
|
| 20 |
-
updated_at:
|
| 21 |
"""Timestamp of the last update."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
@@ -34,9 +34,9 @@ class ObjectSummary:
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("ObjectSummary", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["id"] = self.id
|
| 41 |
result["name"] = self.name
|
| 42 |
if self.updated_at is not None:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 17 |
"""Unique identifier of the object."""
|
| 18 |
name: str
|
| 19 |
"""Unique name of the object."""
|
| 20 |
+
updated_at: datetime | None = None
|
| 21 |
"""Timestamp of the last update."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
+
def from_dict(cls, data: dict[str, Any]) -> ObjectSummary:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
|
|
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("ObjectSummary", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["id"] = self.id
|
| 41 |
result["name"] = self.name
|
| 42 |
if self.updated_at is not None:
|
python/src/workos/vault/models/object_version.py|
@@ -4,9 +4,9 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
@@ -25,7 +25,7 @@ class ObjectVersion:
|
|
| 25 |
"""Number of bytes of stored data."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
-
def from_dict(cls, data:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
@@ -38,9 +38,9 @@ class ObjectVersion:
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("ObjectVersion", e)
|
| 40 |
|
| 41 |
-
def to_dict(self) ->
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
-
result:
|
| 44 |
result["created_at"] = _format_datetime(self.created_at)
|
| 45 |
result["current_version"] = self.current_version
|
| 46 |
result["etag"] = self.etag
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 10 |
|
| 11 |
|
| 12 |
@dataclass(slots=True)
|
|
|
|
| 25 |
"""Number of bytes of stored data."""
|
| 26 |
|
| 27 |
@classmethod
|
| 28 |
+
def from_dict(cls, data: dict[str, Any]) -> ObjectVersion:
|
| 29 |
"""Deserialize from a dictionary."""
|
| 30 |
try:
|
| 31 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("ObjectVersion", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
result["created_at"] = _format_datetime(self.created_at)
|
| 45 |
result["current_version"] = self.current_version
|
| 46 |
result["etag"] = self.etag
|
python/src/workos/vault/models/object_without_value.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .object_metadata import ObjectMetadata
|
|
@@ -16,27 +16,27 @@ class ObjectWithoutValue:
|
|
| 16 |
|
| 17 |
id: str
|
| 18 |
"""Unique identifier of the object."""
|
| 19 |
-
metadata:
|
| 20 |
name: str
|
| 21 |
"""Unique name of the object."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
-
def from_dict(cls, data:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
| 28 |
id=data["id"],
|
| 29 |
metadata=ObjectMetadata.from_dict(
|
| 30 |
-
cast(
|
| 31 |
),
|
| 32 |
name=data["name"],
|
| 33 |
)
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("ObjectWithoutValue", e)
|
| 36 |
|
| 37 |
-
def to_dict(self) ->
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
-
result:
|
| 40 |
result["id"] = self.id
|
| 41 |
result["metadata"] = self.metadata.to_dict()
|
| 42 |
result["name"] = self.name
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .object_metadata import ObjectMetadata
|
|
|
|
| 16 |
|
| 17 |
id: str
|
| 18 |
"""Unique identifier of the object."""
|
| 19 |
+
metadata: ObjectMetadata
|
| 20 |
name: str
|
| 21 |
"""Unique name of the object."""
|
| 22 |
|
| 23 |
@classmethod
|
| 24 |
+
def from_dict(cls, data: dict[str, Any]) -> ObjectWithoutValue:
|
| 25 |
"""Deserialize from a dictionary."""
|
| 26 |
try:
|
| 27 |
return cls(
|
| 28 |
id=data["id"],
|
| 29 |
metadata=ObjectMetadata.from_dict(
|
| 30 |
+
cast(dict[str, Any], data["metadata"])
|
| 31 |
),
|
| 32 |
name=data["name"],
|
| 33 |
)
|
| 34 |
except (KeyError, ValueError) as e:
|
| 35 |
_raise_deserialize_error("ObjectWithoutValue", e)
|
| 36 |
|
| 37 |
+
def to_dict(self) -> dict[str, Any]:
|
| 38 |
"""Serialize to a dictionary."""
|
| 39 |
+
result: dict[str, Any] = {}
|
| 40 |
result["id"] = self.id
|
| 41 |
result["metadata"] = self.metadata.to_dict()
|
| 42 |
result["name"] = self.name
|
python/src/workos/vault/models/rekey_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -11,13 +12,13 @@ from workos._types import _raise_deserialize_error
|
|
| 11 |
class RekeyRequest:
|
| 12 |
"""Rekey Request model."""
|
| 13 |
|
| 14 |
-
context:
|
| 15 |
"""Map of values used to determine the new encryption key."""
|
| 16 |
encrypted_keys: str
|
| 17 |
"""Base64-encoded encrypted data key blob to re-encrypt."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class RekeyRequest:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("RekeyRequest", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["context"] = self.context
|
| 34 |
result["encrypted_keys"] = self.encrypted_keys
|
| 35 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 12 |
class RekeyRequest:
|
| 13 |
"""Rekey Request model."""
|
| 14 |
|
| 15 |
+
context: dict[str, str]
|
| 16 |
"""Map of values used to determine the new encryption key."""
|
| 17 |
encrypted_keys: str
|
| 18 |
"""Base64-encoded encrypted data key blob to re-encrypt."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> RekeyRequest:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("RekeyRequest", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["context"] = self.context
|
| 35 |
result["encrypted_keys"] = self.encrypted_keys
|
| 36 |
return result
|
python/src/workos/vault/models/update_object_request.py|
@@ -3,7 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import Any
|
|
|
|
| 7 |
from workos._types import _raise_deserialize_error
|
| 8 |
|
| 9 |
|
|
@@ -13,11 +14,11 @@ class UpdateObjectRequest:
|
|
| 13 |
|
| 14 |
value: str
|
| 15 |
"""New plaintext value."""
|
| 16 |
-
version_check:
|
| 17 |
"""ID of the expected current version for optimistic locking."""
|
| 18 |
|
| 19 |
@classmethod
|
| 20 |
-
def from_dict(cls, data:
|
| 21 |
"""Deserialize from a dictionary."""
|
| 22 |
try:
|
| 23 |
return cls(
|
|
@@ -27,9 +28,9 @@ class UpdateObjectRequest:
|
|
| 27 |
except (KeyError, ValueError) as e:
|
| 28 |
_raise_deserialize_error("UpdateObjectRequest", e)
|
| 29 |
|
| 30 |
-
def to_dict(self) ->
|
| 31 |
"""Serialize to a dictionary."""
|
| 32 |
-
result:
|
| 33 |
result["value"] = self.value
|
| 34 |
if self.version_check is not None:
|
| 35 |
result["version_check"] = self.version_check
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
|
|
|
|
| 14 |
|
| 15 |
value: str
|
| 16 |
"""New plaintext value."""
|
| 17 |
+
version_check: str | None = None
|
| 18 |
"""ID of the expected current version for optimistic locking."""
|
| 19 |
|
| 20 |
@classmethod
|
| 21 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateObjectRequest:
|
| 22 |
"""Deserialize from a dictionary."""
|
| 23 |
try:
|
| 24 |
return cls(
|
|
|
|
| 28 |
except (KeyError, ValueError) as e:
|
| 29 |
_raise_deserialize_error("UpdateObjectRequest", e)
|
| 30 |
|
| 31 |
+
def to_dict(self) -> dict[str, Any]:
|
| 32 |
"""Serialize to a dictionary."""
|
| 33 |
+
result: dict[str, Any] = {}
|
| 34 |
result["value"] = self.value
|
| 35 |
if self.version_check is not None:
|
| 36 |
result["version_check"] = self.version_check
|
python/src/workos/vault/models/vault_object.py|
@@ -3,8 +3,8 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any,
|
|
|
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .object_metadata import ObjectMetadata
|
|
@@ -16,20 +16,20 @@ class VaultObject:
|
|
| 16 |
|
| 17 |
id: str
|
| 18 |
"""Unique identifier of the object."""
|
| 19 |
-
metadata:
|
| 20 |
name: str
|
| 21 |
"""Unique name of the object."""
|
| 22 |
value: str
|
| 23 |
"""Decrypted plaintext value."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
-
def from_dict(cls, data:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
id=data["id"],
|
| 31 |
metadata=ObjectMetadata.from_dict(
|
| 32 |
-
cast(
|
| 33 |
),
|
| 34 |
name=data["name"],
|
| 35 |
value=data["value"],
|
|
@@ -37,9 +37,9 @@ class VaultObject:
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("VaultObject", e)
|
| 39 |
|
| 40 |
-
def to_dict(self) ->
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
-
result:
|
| 43 |
result["id"] = self.id
|
| 44 |
result["metadata"] = self.metadata.to_dict()
|
| 45 |
result["name"] = self.name
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
|
|
|
| 6 |
+
from typing import Any, cast
|
| 7 |
+
|
| 8 |
from workos._types import _raise_deserialize_error
|
| 9 |
|
| 10 |
from .object_metadata import ObjectMetadata
|
|
|
|
| 16 |
|
| 17 |
id: str
|
| 18 |
"""Unique identifier of the object."""
|
| 19 |
+
metadata: ObjectMetadata
|
| 20 |
name: str
|
| 21 |
"""Unique name of the object."""
|
| 22 |
value: str
|
| 23 |
"""Decrypted plaintext value."""
|
| 24 |
|
| 25 |
@classmethod
|
| 26 |
+
def from_dict(cls, data: dict[str, Any]) -> VaultObject:
|
| 27 |
"""Deserialize from a dictionary."""
|
| 28 |
try:
|
| 29 |
return cls(
|
| 30 |
id=data["id"],
|
| 31 |
metadata=ObjectMetadata.from_dict(
|
| 32 |
+
cast(dict[str, Any], data["metadata"])
|
| 33 |
),
|
| 34 |
name=data["name"],
|
| 35 |
value=data["value"],
|
|
|
|
| 37 |
except (KeyError, ValueError) as e:
|
| 38 |
_raise_deserialize_error("VaultObject", e)
|
| 39 |
|
| 40 |
+
def to_dict(self) -> dict[str, Any]:
|
| 41 |
"""Serialize to a dictionary."""
|
| 42 |
+
result: dict[str, Any] = {}
|
| 43 |
result["id"] = self.id
|
| 44 |
result["metadata"] = self.metadata.to_dict()
|
| 45 |
result["name"] = self.name
|
python/src/workos/vault/models/vault_order.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Optional
|
| 9 |
from typing import Literal, TypeAlias
|
| 10 |
|
| 11 |
|
|
@@ -16,7 +15,7 @@ class VaultOrder(str, Enum):
|
|
| 16 |
DESC = "desc"
|
| 17 |
|
| 18 |
@classmethod
|
| 19 |
-
def _missing_(cls, value: object) ->
|
| 20 |
if not isinstance(value, str):
|
| 21 |
return None
|
| 22 |
unknown = str.__new__(cls, value)
|
|
|
|
| 5 |
from __future__ import annotations
|
| 6 |
|
| 7 |
from enum import Enum
|
|
|
|
| 8 |
from typing import Literal, TypeAlias
|
| 9 |
|
| 10 |
|
|
|
|
| 15 |
DESC = "desc"
|
| 16 |
|
| 17 |
@classmethod
|
| 18 |
+
def _missing_(cls, value: object) -> VaultOrder | None:
|
| 19 |
if not isinstance(value, str):
|
| 20 |
return None
|
| 21 |
unknown = str.__new__(cls, value)
|
python/src/workos/vault/models/version_list_response.py|
@@ -3,11 +3,11 @@
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
-
from typing import cast
|
| 7 |
-
from typing import Any, Dict, List
|
| 8 |
-
from workos._types import _raise_deserialize_error
|
| 9 |
|
|
|
|
| 10 |
from workos.common.models.list_metadata import ListMetadata
|
|
|
|
| 11 |
from .object_version import ObjectVersion
|
| 12 |
|
| 13 |
|
|
@@ -15,29 +15,29 @@ from .object_version import ObjectVersion
|
|
| 15 |
class VersionListResponse:
|
| 16 |
"""Version List Response model."""
|
| 17 |
|
| 18 |
-
data:
|
| 19 |
"""List of object versions."""
|
| 20 |
-
list_metadata:
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
-
def from_dict(cls, data:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
data=[
|
| 28 |
-
ObjectVersion.from_dict(cast(
|
| 29 |
for item in cast(list[Any], data["data"])
|
| 30 |
],
|
| 31 |
list_metadata=ListMetadata.from_dict(
|
| 32 |
-
cast(
|
| 33 |
),
|
| 34 |
)
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("VersionListResponse", e)
|
| 37 |
|
| 38 |
-
def to_dict(self) ->
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
-
result:
|
| 41 |
result["data"] = [item.to_dict() for item in self.data]
|
| 42 |
result["list_metadata"] = self.list_metadata.to_dict()
|
| 43 |
return result
|
|
|
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
+
from typing import Any, cast
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
from workos._types import _raise_deserialize_error
|
| 9 |
from workos.common.models.list_metadata import ListMetadata
|
| 10 |
+
|
| 11 |
from .object_version import ObjectVersion
|
| 12 |
|
| 13 |
|
|
|
|
| 15 |
class VersionListResponse:
|
| 16 |
"""Version List Response model."""
|
| 17 |
|
| 18 |
+
data: list[ObjectVersion]
|
| 19 |
"""List of object versions."""
|
| 20 |
+
list_metadata: ListMetadata
|
| 21 |
|
| 22 |
@classmethod
|
| 23 |
+
def from_dict(cls, data: dict[str, Any]) -> VersionListResponse:
|
| 24 |
"""Deserialize from a dictionary."""
|
| 25 |
try:
|
| 26 |
return cls(
|
| 27 |
data=[
|
| 28 |
+
ObjectVersion.from_dict(cast(dict[str, Any], item))
|
| 29 |
for item in cast(list[Any], data["data"])
|
| 30 |
],
|
| 31 |
list_metadata=ListMetadata.from_dict(
|
| 32 |
+
cast(dict[str, Any], data["list_metadata"])
|
| 33 |
),
|
| 34 |
)
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("VersionListResponse", e)
|
| 37 |
|
| 38 |
+
def to_dict(self) -> dict[str, Any]:
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
+
result: dict[str, Any] = {}
|
| 41 |
result["data"] = [item.to_dict() for item in self.data]
|
| 42 |
result["list_metadata"] = self.list_metadata.to_dict()
|
| 43 |
return result
|
python/src/workos/webhooks/_resource.py|
@@ -2,13 +2,16 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
-
from .._types import RequestOptions, enum_value
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
from workos.common.models.create_webhook_endpoint_events import (
|
| 13 |
CreateWebhookEndpointEvents,
|
| 14 |
)
|
|
@@ -19,11 +22,10 @@ from workos.common.models.update_webhook_endpoint_events import (
|
|
| 19 |
from workos.common.models.update_webhook_endpoint_status import (
|
| 20 |
UpdateWebhookEndpointStatus,
|
| 21 |
)
|
|
|
|
| 22 |
from .._pagination import AsyncPage, SyncPage
|
|
|
|
| 23 |
-
import
|
| 24 |
-
import hmac
|
| 25 |
-
import json
|
| 26 |
-
import time
|
| 27 |
|
| 28 |
# @oagen-ignore-start
|
| 29 |
if TYPE_CHECKING:
|
|
@@ -34,17 +36,17 @@ if TYPE_CHECKING:
|
|
| 34 |
class Webhooks:
|
| 35 |
"""Webhooks API resources."""
|
| 36 |
|
| 37 |
-
def __init__(self, client:
|
| 38 |
self._client = client
|
| 39 |
|
| 40 |
def list_webhook_endpoints(
|
| 41 |
self,
|
| 42 |
*,
|
| 43 |
-
limit:
|
| 44 |
-
before:
|
| 45 |
-
after:
|
| 46 |
-
order:
|
| 47 |
-
request_options:
|
| 48 |
) -> SyncPage[WebhookEndpoint]:
|
| 49 |
"""List Webhook Endpoints
|
| 50 |
|
|
@@ -87,8 +89,8 @@ class Webhooks:
|
|
| 87 |
self,
|
| 88 |
*,
|
| 89 |
endpoint_url: str,
|
| 90 |
-
events:
|
| 91 |
-
request_options:
|
| 92 |
) -> WebhookEndpoint:
|
| 93 |
"""Create a Webhook Endpoint
|
| 94 |
|
|
@@ -109,7 +111,7 @@ class Webhooks:
|
|
| 109 |
RateLimitExceededError: If rate limited (429).
|
| 110 |
ServerError: If the server returns a 5xx error.
|
| 111 |
"""
|
| 112 |
-
body:
|
| 113 |
"endpoint_url": endpoint_url,
|
| 114 |
"events": events,
|
| 115 |
}
|
|
@@ -125,10 +127,10 @@ class Webhooks:
|
|
| 125 |
self,
|
| 126 |
id: str,
|
| 127 |
*,
|
| 128 |
-
endpoint_url:
|
| 129 |
-
status:
|
| 130 |
-
events:
|
| 131 |
-
request_options:
|
| 132 |
) -> WebhookEndpoint:
|
| 133 |
"""Update a Webhook Endpoint
|
| 134 |
|
|
@@ -152,7 +154,7 @@ class Webhooks:
|
|
| 152 |
RateLimitExceededError: If rate limited (429).
|
| 153 |
ServerError: If the server returns a 5xx error.
|
| 154 |
"""
|
| 155 |
-
body:
|
| 156 |
k: v
|
| 157 |
for k, v in {
|
| 158 |
"endpoint_url": endpoint_url,
|
|
@@ -173,7 +175,7 @@ class Webhooks:
|
|
| 173 |
self,
|
| 174 |
id: str,
|
| 175 |
*,
|
| 176 |
-
request_options:
|
| 177 |
) -> None:
|
| 178 |
"""Delete a Webhook Endpoint
|
| 179 |
|
|
@@ -201,11 +203,11 @@ class Webhooks:
|
|
| 201 |
def verify_event(
|
| 202 |
self,
|
| 203 |
*,
|
| 204 |
-
event_body:
|
| 205 |
event_signature: str,
|
| 206 |
secret: str,
|
| 207 |
-
tolerance:
|
| 208 |
-
) ->
|
| 209 |
"""Verify and deserialize the signature of a Webhook event.
|
| 210 |
|
| 211 |
Args:
|
|
@@ -234,10 +236,10 @@ class Webhooks:
|
|
| 234 |
def verify_header(
|
| 235 |
self,
|
| 236 |
*,
|
| 237 |
-
event_body:
|
| 238 |
event_signature: str,
|
| 239 |
secret: str,
|
| 240 |
-
tolerance:
|
| 241 |
) -> None:
|
| 242 |
"""Verify the signature of a Webhook, raise ValueError if invalid.
|
| 243 |
|
|
@@ -291,17 +293,17 @@ class Webhooks:
|
|
| 291 |
class AsyncWebhooks:
|
| 292 |
"""Webhooks API resources (async)."""
|
| 293 |
|
| 294 |
-
def __init__(self, client:
|
| 295 |
self._client = client
|
| 296 |
|
| 297 |
async def list_webhook_endpoints(
|
| 298 |
self,
|
| 299 |
*,
|
| 300 |
-
limit:
|
| 301 |
-
before:
|
| 302 |
-
after:
|
| 303 |
-
order:
|
| 304 |
-
request_options:
|
| 305 |
) -> AsyncPage[WebhookEndpoint]:
|
| 306 |
"""List Webhook Endpoints
|
| 307 |
|
|
@@ -344,8 +346,8 @@ class AsyncWebhooks:
|
|
| 344 |
self,
|
| 345 |
*,
|
| 346 |
endpoint_url: str,
|
| 347 |
-
events:
|
| 348 |
-
request_options:
|
| 349 |
) -> WebhookEndpoint:
|
| 350 |
"""Create a Webhook Endpoint
|
| 351 |
|
|
@@ -366,7 +368,7 @@ class AsyncWebhooks:
|
|
| 366 |
RateLimitExceededError: If rate limited (429).
|
| 367 |
ServerError: If the server returns a 5xx error.
|
| 368 |
"""
|
| 369 |
-
body:
|
| 370 |
"endpoint_url": endpoint_url,
|
| 371 |
"events": events,
|
| 372 |
}
|
|
@@ -382,10 +384,10 @@ class AsyncWebhooks:
|
|
| 382 |
self,
|
| 383 |
id: str,
|
| 384 |
*,
|
| 385 |
-
endpoint_url:
|
| 386 |
-
status:
|
| 387 |
-
events:
|
| 388 |
-
request_options:
|
| 389 |
) -> WebhookEndpoint:
|
| 390 |
"""Update a Webhook Endpoint
|
| 391 |
|
|
@@ -409,7 +411,7 @@ class AsyncWebhooks:
|
|
| 409 |
RateLimitExceededError: If rate limited (429).
|
| 410 |
ServerError: If the server returns a 5xx error.
|
| 411 |
"""
|
| 412 |
-
body:
|
| 413 |
k: v
|
| 414 |
for k, v in {
|
| 415 |
"endpoint_url": endpoint_url,
|
|
@@ -430,7 +432,7 @@ class AsyncWebhooks:
|
|
| 430 |
self,
|
| 431 |
id: str,
|
| 432 |
*,
|
| 433 |
-
request_options:
|
| 434 |
) -> None:
|
| 435 |
"""Delete a Webhook Endpoint
|
| 436 |
|
|
@@ -458,11 +460,11 @@ class AsyncWebhooks:
|
|
| 458 |
def verify_event(
|
| 459 |
self,
|
| 460 |
*,
|
| 461 |
-
event_body:
|
| 462 |
event_signature: str,
|
| 463 |
secret: str,
|
| 464 |
-
tolerance:
|
| 465 |
-
) ->
|
| 466 |
"""Verify and deserialize the signature of a Webhook event.
|
| 467 |
|
| 468 |
Args:
|
|
@@ -491,10 +493,10 @@ class AsyncWebhooks:
|
|
| 491 |
def verify_header(
|
| 492 |
self,
|
| 493 |
*,
|
| 494 |
-
event_body:
|
| 495 |
event_signature: str,
|
| 496 |
secret: str,
|
| 497 |
-
tolerance:
|
| 498 |
) -> None:
|
| 499 |
"""Verify the signature of a Webhook, raise ValueError if invalid.
|
| 500 |
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
| 10 |
+
import hashlib
|
| 11 |
+
import hmac
|
| 12 |
+
import json
|
| 13 |
+
import time
|
| 14 |
+
|
| 15 |
from workos.common.models.create_webhook_endpoint_events import (
|
| 16 |
CreateWebhookEndpointEvents,
|
| 17 |
)
|
|
|
|
| 22 |
from workos.common.models.update_webhook_endpoint_status import (
|
| 23 |
UpdateWebhookEndpointStatus,
|
| 24 |
)
|
| 25 |
+
|
| 26 |
from .._pagination import AsyncPage, SyncPage
|
| 27 |
+
from .._types import RequestOptions, enum_value
|
| 28 |
+
from .models import WebhookEndpoint
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# @oagen-ignore-start
|
| 31 |
if TYPE_CHECKING:
|
|
|
|
| 36 |
class Webhooks:
|
| 37 |
"""Webhooks API resources."""
|
| 38 |
|
| 39 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 40 |
self._client = client
|
| 41 |
|
| 42 |
def list_webhook_endpoints(
|
| 43 |
self,
|
| 44 |
*,
|
| 45 |
+
limit: int | None = None,
|
| 46 |
+
before: str | None = None,
|
| 47 |
+
after: str | None = None,
|
| 48 |
+
order: PaginationOrder | str | None = "desc",
|
| 49 |
+
request_options: RequestOptions | None = None,
|
| 50 |
) -> SyncPage[WebhookEndpoint]:
|
| 51 |
"""List Webhook Endpoints
|
| 52 |
|
|
|
|
| 89 |
self,
|
| 90 |
*,
|
| 91 |
endpoint_url: str,
|
| 92 |
+
events: list[CreateWebhookEndpointEvents | str],
|
| 93 |
+
request_options: RequestOptions | None = None,
|
| 94 |
) -> WebhookEndpoint:
|
| 95 |
"""Create a Webhook Endpoint
|
| 96 |
|
|
|
|
| 111 |
RateLimitExceededError: If rate limited (429).
|
| 112 |
ServerError: If the server returns a 5xx error.
|
| 113 |
"""
|
| 114 |
+
body: dict[str, Any] = {
|
| 115 |
"endpoint_url": endpoint_url,
|
| 116 |
"events": events,
|
| 117 |
}
|
|
|
|
| 127 |
self,
|
| 128 |
id: str,
|
| 129 |
*,
|
| 130 |
+
endpoint_url: str | None = None,
|
| 131 |
+
status: UpdateWebhookEndpointStatus | str | None = None,
|
| 132 |
+
events: list[UpdateWebhookEndpointEvents | str] | None = None,
|
| 133 |
+
request_options: RequestOptions | None = None,
|
| 134 |
) -> WebhookEndpoint:
|
| 135 |
"""Update a Webhook Endpoint
|
| 136 |
|
|
|
|
| 154 |
RateLimitExceededError: If rate limited (429).
|
| 155 |
ServerError: If the server returns a 5xx error.
|
| 156 |
"""
|
| 157 |
+
body: dict[str, Any] = {
|
| 158 |
k: v
|
| 159 |
for k, v in {
|
| 160 |
"endpoint_url": endpoint_url,
|
|
|
|
| 175 |
self,
|
| 176 |
id: str,
|
| 177 |
*,
|
| 178 |
+
request_options: RequestOptions | None = None,
|
| 179 |
) -> None:
|
| 180 |
"""Delete a Webhook Endpoint
|
| 181 |
|
|
|
|
| 203 |
def verify_event(
|
| 204 |
self,
|
| 205 |
*,
|
| 206 |
+
event_body: bytes | str,
|
| 207 |
event_signature: str,
|
| 208 |
secret: str,
|
| 209 |
+
tolerance: int | None = None,
|
| 210 |
+
) -> EventSchemaVariant:
|
| 211 |
"""Verify and deserialize the signature of a Webhook event.
|
| 212 |
|
| 213 |
Args:
|
|
|
|
| 236 |
def verify_header(
|
| 237 |
self,
|
| 238 |
*,
|
| 239 |
+
event_body: bytes | str,
|
| 240 |
event_signature: str,
|
| 241 |
secret: str,
|
| 242 |
+
tolerance: int | None = None,
|
| 243 |
) -> None:
|
| 244 |
"""Verify the signature of a Webhook, raise ValueError if invalid.
|
| 245 |
|
|
|
|
| 293 |
class AsyncWebhooks:
|
| 294 |
"""Webhooks API resources (async)."""
|
| 295 |
|
| 296 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 297 |
self._client = client
|
| 298 |
|
| 299 |
async def list_webhook_endpoints(
|
| 300 |
self,
|
| 301 |
*,
|
| 302 |
+
limit: int | None = None,
|
| 303 |
+
before: str | None = None,
|
| 304 |
+
after: str | None = None,
|
| 305 |
+
order: PaginationOrder | str | None = "desc",
|
| 306 |
+
request_options: RequestOptions | None = None,
|
| 307 |
) -> AsyncPage[WebhookEndpoint]:
|
| 308 |
"""List Webhook Endpoints
|
| 309 |
|
|
|
|
| 346 |
self,
|
| 347 |
*,
|
| 348 |
endpoint_url: str,
|
| 349 |
+
events: list[CreateWebhookEndpointEvents | str],
|
| 350 |
+
request_options: RequestOptions | None = None,
|
| 351 |
) -> WebhookEndpoint:
|
| 352 |
"""Create a Webhook Endpoint
|
| 353 |
|
|
|
|
| 368 |
RateLimitExceededError: If rate limited (429).
|
| 369 |
ServerError: If the server returns a 5xx error.
|
| 370 |
"""
|
| 371 |
+
body: dict[str, Any] = {
|
| 372 |
"endpoint_url": endpoint_url,
|
| 373 |
"events": events,
|
| 374 |
}
|
|
|
|
| 384 |
self,
|
| 385 |
id: str,
|
| 386 |
*,
|
| 387 |
+
endpoint_url: str | None = None,
|
| 388 |
+
status: UpdateWebhookEndpointStatus | str | None = None,
|
| 389 |
+
events: list[UpdateWebhookEndpointEvents | str] | None = None,
|
| 390 |
+
request_options: RequestOptions | None = None,
|
| 391 |
) -> WebhookEndpoint:
|
| 392 |
"""Update a Webhook Endpoint
|
| 393 |
|
|
|
|
| 411 |
RateLimitExceededError: If rate limited (429).
|
| 412 |
ServerError: If the server returns a 5xx error.
|
| 413 |
"""
|
| 414 |
+
body: dict[str, Any] = {
|
| 415 |
k: v
|
| 416 |
for k, v in {
|
| 417 |
"endpoint_url": endpoint_url,
|
|
|
|
| 432 |
self,
|
| 433 |
id: str,
|
| 434 |
*,
|
| 435 |
+
request_options: RequestOptions | None = None,
|
| 436 |
) -> None:
|
| 437 |
"""Delete a Webhook Endpoint
|
| 438 |
|
|
|
|
| 460 |
def verify_event(
|
| 461 |
self,
|
| 462 |
*,
|
| 463 |
+
event_body: bytes | str,
|
| 464 |
event_signature: str,
|
| 465 |
secret: str,
|
| 466 |
+
tolerance: int | None = None,
|
| 467 |
+
) -> EventSchemaVariant:
|
| 468 |
"""Verify and deserialize the signature of a Webhook event.
|
| 469 |
|
| 470 |
Args:
|
|
|
|
| 493 |
def verify_header(
|
| 494 |
self,
|
| 495 |
*,
|
| 496 |
+
event_body: bytes | str,
|
| 497 |
event_signature: str,
|
| 498 |
secret: str,
|
| 499 |
+
tolerance: int | None = None,
|
| 500 |
) -> None:
|
| 501 |
"""Verify the signature of a Webhook, raise ValueError if invalid.
|
| 502 |
|
python/src/workos/webhooks/models/create_webhook_endpoint.py|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.create_webhook_endpoint_events import (
|
| 11 |
CreateWebhookEndpointEvents,
|
|
@@ -18,11 +18,11 @@ class CreateWebhookEndpoint:
|
|
| 18 |
|
| 19 |
endpoint_url: str
|
| 20 |
"""The HTTPS URL where webhooks will be sent."""
|
| 21 |
-
events:
|
| 22 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def from_dict(cls, data:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
@@ -35,9 +35,9 @@ class CreateWebhookEndpoint:
|
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("CreateWebhookEndpoint", e)
|
| 37 |
|
| 38 |
-
def to_dict(self) ->
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
-
result:
|
| 41 |
result["endpoint_url"] = self.endpoint_url
|
| 42 |
result["events"] = [
|
| 43 |
item.value if isinstance(item, Enum) else item for item in self.events
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.create_webhook_endpoint_events import (
|
| 11 |
CreateWebhookEndpointEvents,
|
|
|
|
| 18 |
|
| 19 |
endpoint_url: str
|
| 20 |
"""The HTTPS URL where webhooks will be sent."""
|
| 21 |
+
events: list[CreateWebhookEndpointEvents]
|
| 22 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> CreateWebhookEndpoint:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 35 |
except (KeyError, ValueError) as e:
|
| 36 |
_raise_deserialize_error("CreateWebhookEndpoint", e)
|
| 37 |
|
| 38 |
+
def to_dict(self) -> dict[str, Any]:
|
| 39 |
"""Serialize to a dictionary."""
|
| 40 |
+
result: dict[str, Any] = {}
|
| 41 |
result["endpoint_url"] = self.endpoint_url
|
| 42 |
result["events"] = [
|
| 43 |
item.value if isinstance(item, Enum) else item for item in self.events
|
python/src/workos/webhooks/models/update_webhook_endpoint.py|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.update_webhook_endpoint_events import (
|
| 11 |
UpdateWebhookEndpointEvents,
|
|
@@ -19,15 +19,15 @@ from workos.common.models.update_webhook_endpoint_status import (
|
|
| 19 |
class UpdateWebhookEndpoint:
|
| 20 |
"""Update Webhook Endpoint model."""
|
| 21 |
|
| 22 |
-
endpoint_url:
|
| 23 |
"""The HTTPS URL where webhooks will be sent."""
|
| 24 |
-
status:
|
| 25 |
"""Whether the Webhook Endpoint is enabled or disabled."""
|
| 26 |
-
events:
|
| 27 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
-
def from_dict(cls, data:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
@@ -45,9 +45,9 @@ class UpdateWebhookEndpoint:
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("UpdateWebhookEndpoint", e)
|
| 47 |
|
| 48 |
-
def to_dict(self) ->
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
-
result:
|
| 51 |
if self.endpoint_url is not None:
|
| 52 |
result["endpoint_url"] = self.endpoint_url
|
| 53 |
if self.status is not None:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.update_webhook_endpoint_events import (
|
| 11 |
UpdateWebhookEndpointEvents,
|
|
|
|
| 19 |
class UpdateWebhookEndpoint:
|
| 20 |
"""Update Webhook Endpoint model."""
|
| 21 |
|
| 22 |
+
endpoint_url: str | None = None
|
| 23 |
"""The HTTPS URL where webhooks will be sent."""
|
| 24 |
+
status: UpdateWebhookEndpointStatus | None = None
|
| 25 |
"""Whether the Webhook Endpoint is enabled or disabled."""
|
| 26 |
+
events: list[UpdateWebhookEndpointEvents] | None = None
|
| 27 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 28 |
|
| 29 |
@classmethod
|
| 30 |
+
def from_dict(cls, data: dict[str, Any]) -> UpdateWebhookEndpoint:
|
| 31 |
"""Deserialize from a dictionary."""
|
| 32 |
try:
|
| 33 |
return cls(
|
|
|
|
| 45 |
except (KeyError, ValueError) as e:
|
| 46 |
_raise_deserialize_error("UpdateWebhookEndpoint", e)
|
| 47 |
|
| 48 |
+
def to_dict(self) -> dict[str, Any]:
|
| 49 |
"""Serialize to a dictionary."""
|
| 50 |
+
result: dict[str, Any] = {}
|
| 51 |
if self.endpoint_url is not None:
|
| 52 |
result["endpoint_url"] = self.endpoint_url
|
| 53 |
if self.status is not None:
|
python/src/workos/webhooks/models/webhook_endpoint.py|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
-
from typing import Any,
|
| 9 |
-
|
| 10 |
-
from workos._types import _format_datetime, _parse_datetime
|
| 11 |
from workos.common.models.webhook_endpoint_status import WebhookEndpointStatus
|
| 12 |
|
| 13 |
|
|
@@ -23,9 +23,9 @@ class WebhookEndpoint:
|
|
| 23 |
"""The URL to which webhooks are sent."""
|
| 24 |
secret: str
|
| 25 |
"""The secret used to sign webhook payloads."""
|
| 26 |
-
status:
|
| 27 |
"""Whether the Webhook Endpoint is enabled or disabled."""
|
| 28 |
-
events:
|
| 29 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
@@ -33,7 +33,7 @@ class WebhookEndpoint:
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
-
def from_dict(cls, data:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
@@ -49,9 +49,9 @@ class WebhookEndpoint:
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("WebhookEndpoint", e)
|
| 51 |
|
| 52 |
-
def to_dict(self) ->
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
-
result:
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["endpoint_url"] = self.endpoint_url
|
|
|
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from datetime import datetime
|
| 7 |
from enum import Enum
|
| 8 |
+
from typing import Any, Literal
|
| 9 |
+
|
| 10 |
+
from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error
|
| 11 |
from workos.common.models.webhook_endpoint_status import WebhookEndpointStatus
|
| 12 |
|
| 13 |
|
|
|
|
| 23 |
"""The URL to which webhooks are sent."""
|
| 24 |
secret: str
|
| 25 |
"""The secret used to sign webhook payloads."""
|
| 26 |
+
status: WebhookEndpointStatus
|
| 27 |
"""Whether the Webhook Endpoint is enabled or disabled."""
|
| 28 |
+
events: list[str]
|
| 29 |
"""The events that the Webhook Endpoint is subscribed to."""
|
| 30 |
created_at: datetime
|
| 31 |
"""An ISO 8601 timestamp."""
|
|
|
|
| 33 |
"""An ISO 8601 timestamp."""
|
| 34 |
|
| 35 |
@classmethod
|
| 36 |
+
def from_dict(cls, data: dict[str, Any]) -> WebhookEndpoint:
|
| 37 |
"""Deserialize from a dictionary."""
|
| 38 |
try:
|
| 39 |
return cls(
|
|
|
|
| 49 |
except (KeyError, ValueError) as e:
|
| 50 |
_raise_deserialize_error("WebhookEndpoint", e)
|
| 51 |
|
| 52 |
+
def to_dict(self) -> dict[str, Any]:
|
| 53 |
"""Serialize to a dictionary."""
|
| 54 |
+
result: dict[str, Any] = {}
|
| 55 |
result["object"] = self.object
|
| 56 |
result["id"] = self.id
|
| 57 |
result["endpoint_url"] = self.endpoint_url
|
python/src/workos/widgets/_resource.py|
@@ -2,29 +2,30 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
|
|
|
|
|
|
| 10 |
from .._types import RequestOptions
|
| 11 |
from .models import WidgetSessionTokenResponse
|
| 12 |
-
from workos.common.models.widget_session_token_scopes import WidgetSessionTokenScopes
|
| 13 |
|
| 14 |
|
| 15 |
class Widgets:
|
| 16 |
"""Widgets API resources."""
|
| 17 |
|
| 18 |
-
def __init__(self, client:
|
| 19 |
self._client = client
|
| 20 |
|
| 21 |
def create_token(
|
| 22 |
self,
|
| 23 |
*,
|
| 24 |
-
organization_id:
|
| 25 |
-
user_id:
|
| 26 |
-
scopes:
|
| 27 |
-
request_options:
|
| 28 |
) -> WidgetSessionTokenResponse:
|
| 29 |
"""Generate a widget token
|
| 30 |
|
|
@@ -47,7 +48,7 @@ class Widgets:
|
|
| 47 |
RateLimitExceededError: If rate limited (429).
|
| 48 |
ServerError: If the server returns a 5xx error.
|
| 49 |
"""
|
| 50 |
-
body:
|
| 51 |
k: v
|
| 52 |
for k, v in {
|
| 53 |
"organization_id": organization_id,
|
|
@@ -68,16 +69,16 @@ class Widgets:
|
|
| 68 |
class AsyncWidgets:
|
| 69 |
"""Widgets API resources (async)."""
|
| 70 |
|
| 71 |
-
def __init__(self, client:
|
| 72 |
self._client = client
|
| 73 |
|
| 74 |
async def create_token(
|
| 75 |
self,
|
| 76 |
*,
|
| 77 |
-
organization_id:
|
| 78 |
-
user_id:
|
| 79 |
-
scopes:
|
| 80 |
-
request_options:
|
| 81 |
) -> WidgetSessionTokenResponse:
|
| 82 |
"""Generate a widget token
|
| 83 |
|
|
@@ -100,7 +101,7 @@ class AsyncWidgets:
|
|
| 100 |
RateLimitExceededError: If rate limited (429).
|
| 101 |
ServerError: If the server returns a 5xx error.
|
| 102 |
"""
|
| 103 |
-
body:
|
| 104 |
k: v
|
| 105 |
for k, v in {
|
| 106 |
"organization_id": organization_id,
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from typing import TYPE_CHECKING, Any
|
| 6 |
|
| 7 |
if TYPE_CHECKING:
|
| 8 |
from .._client import AsyncWorkOSClient, WorkOSClient
|
| 9 |
|
| 10 |
+
from workos.common.models.widget_session_token_scopes import WidgetSessionTokenScopes
|
| 11 |
+
|
| 12 |
from .._types import RequestOptions
|
| 13 |
from .models import WidgetSessionTokenResponse
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class Widgets:
|
| 17 |
"""Widgets API resources."""
|
| 18 |
|
| 19 |
+
def __init__(self, client: WorkOSClient) -> None:
|
| 20 |
self._client = client
|
| 21 |
|
| 22 |
def create_token(
|
| 23 |
self,
|
| 24 |
*,
|
| 25 |
+
organization_id: str | None = None,
|
| 26 |
+
user_id: str | None = None,
|
| 27 |
+
scopes: list[WidgetSessionTokenScopes | str] | None = None,
|
| 28 |
+
request_options: RequestOptions | None = None,
|
| 29 |
) -> WidgetSessionTokenResponse:
|
| 30 |
"""Generate a widget token
|
| 31 |
|
|
|
|
| 48 |
RateLimitExceededError: If rate limited (429).
|
| 49 |
ServerError: If the server returns a 5xx error.
|
| 50 |
"""
|
| 51 |
+
body: dict[str, Any] = {
|
| 52 |
k: v
|
| 53 |
for k, v in {
|
| 54 |
"organization_id": organization_id,
|
|
|
|
| 69 |
class AsyncWidgets:
|
| 70 |
"""Widgets API resources (async)."""
|
| 71 |
|
| 72 |
+
def __init__(self, client: AsyncWorkOSClient) -> None:
|
| 73 |
self._client = client
|
| 74 |
|
| 75 |
async def create_token(
|
| 76 |
self,
|
| 77 |
*,
|
| 78 |
+
organization_id: str | None = None,
|
| 79 |
+
user_id: str | None = None,
|
| 80 |
+
scopes: list[WidgetSessionTokenScopes | str] | None = None,
|
| 81 |
+
request_options: RequestOptions | None = None,
|
| 82 |
) -> WidgetSessionTokenResponse:
|
| 83 |
"""Generate a widget token
|
| 84 |
|
|
|
|
| 101 |
RateLimitExceededError: If rate limited (429).
|
| 102 |
ServerError: If the server returns a 5xx error.
|
| 103 |
"""
|
| 104 |
+
body: dict[str, Any] = {
|
| 105 |
k: v
|
| 106 |
for k, v in {
|
| 107 |
"organization_id": organization_id,
|
python/src/workos/widgets/models/widget_session_token.py|
@@ -4,8 +4,8 @@ from __future__ import annotations
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
-
from typing import cast
|
| 8 |
-
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.widget_session_token_scopes import WidgetSessionTokenScopes
|
| 11 |
|
|
@@ -14,15 +14,15 @@ from workos.common.models.widget_session_token_scopes import WidgetSessionTokenS
|
|
| 14 |
class WidgetSessionToken:
|
| 15 |
"""Widget Session Token model."""
|
| 16 |
|
| 17 |
-
organization_id:
|
| 18 |
"""The ID of the organization to scope the widget session to. Required when scopes are provided. Optional when issuing a token for user-only widgets (e.g. `UserProfile`, `UserSecurity`) that do not require organization context."""
|
| 19 |
-
user_id:
|
| 20 |
"""The ID of the user to issue the widget session token for."""
|
| 21 |
-
scopes:
|
| 22 |
"""The scopes to grant the widget session."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
-
def from_dict(cls, data:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
@@ -38,9 +38,9 @@ class WidgetSessionToken:
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("WidgetSessionToken", e)
|
| 40 |
|
| 41 |
-
def to_dict(self) ->
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
-
result:
|
| 44 |
if self.organization_id is not None:
|
| 45 |
result["organization_id"] = self.organization_id
|
| 46 |
if self.user_id is not None:
|
|
|
|
| 4 |
|
| 5 |
from dataclasses import dataclass
|
| 6 |
from enum import Enum
|
| 7 |
+
from typing import Any, cast
|
| 8 |
+
|
| 9 |
from workos._types import _raise_deserialize_error
|
| 10 |
from workos.common.models.widget_session_token_scopes import WidgetSessionTokenScopes
|
| 11 |
|
|
|
|
| 14 |
class WidgetSessionToken:
|
| 15 |
"""Widget Session Token model."""
|
| 16 |
|
| 17 |
+
organization_id: str | None = None
|
| 18 |
"""The ID of the organization to scope the widget session to. Required when scopes are provided. Optional when issuing a token for user-only widgets (e.g. `UserProfile`, `UserSecurity`) that do not require organization context."""
|
| 19 |
+
user_id: str | None = None
|
| 20 |
"""The ID of the user to issue the widget session token for."""
|
| 21 |
+
scopes: list[WidgetSessionTokenScopes] | None = None
|
| 22 |
"""The scopes to grant the widget session."""
|
| 23 |
|
| 24 |
@classmethod
|
| 25 |
+
def from_dict(cls, data: dict[str, Any]) -> WidgetSessionToken:
|
| 26 |
"""Deserialize from a dictionary."""
|
| 27 |
try:
|
| 28 |
return cls(
|
|
|
|
| 38 |
except (KeyError, ValueError) as e:
|
| 39 |
_raise_deserialize_error("WidgetSessionToken", e)
|
| 40 |
|
| 41 |
+
def to_dict(self) -> dict[str, Any]:
|
| 42 |
"""Serialize to a dictionary."""
|
| 43 |
+
result: dict[str, Any] = {}
|
| 44 |
if self.organization_id is not None:
|
| 45 |
result["organization_id"] = self.organization_id
|
| 46 |
if self.user_id is not None:
|
python/tests/fixtures/agent_registration_refreshed.json|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
+
"context": {
|
| 10 |
+
"google_analytics_client_id": "GA1.2.1234567890.1234567890",
|
| 11 |
+
"google_analytics_sessions": [
|
| 12 |
+
{
|
| 13 |
+
"containerId": "GTM-ABCDEF",
|
| 14 |
+
"sessionId": "1234567890",
|
| 15 |
+
"sessionNumber": "1"
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 19 |
+
"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 20 |
+
"actor": {
|
| 21 |
+
"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY",
|
| 22 |
+
"source": "api",
|
| 23 |
+
"name": "Jane Doe"
|
| 24 |
+
},
|
| 25 |
+
"previous_attributes": {
|
| 26 |
+
"key": {}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
}
|
python/tests/fixtures/agent_registration_refreshed_data.json|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 3 |
+
}
|
python/tests/fixtures/connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z"
|
python/tests/fixtures/data_integrations_list_response.json|
@@ -30,6 +30,11 @@
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
"state": "connected",
|
| 34 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 35 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 30 |
],
|
| 31 |
"auth_method": "oauth",
|
| 32 |
"api_key_last_4": null,
|
| 33 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 34 |
+
"client_secret_last_4": "cdef",
|
| 35 |
+
"config": {
|
| 36 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 37 |
+
},
|
| 38 |
"state": "connected",
|
| 39 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 40 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
python/tests/fixtures/data_integrations_list_response_data.json|
@@ -27,6 +27,11 @@
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"state": "connected",
|
| 31 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 32 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 27 |
],
|
| 28 |
"auth_method": "oauth",
|
| 29 |
"api_key_last_4": null,
|
| 30 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 31 |
+
"client_secret_last_4": "cdef",
|
| 32 |
+
"config": {
|
| 33 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 34 |
+
},
|
| 35 |
"state": "connected",
|
| 36 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 37 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
python/tests/fixtures/data_integrations_list_response_data_connected_account.json|
@@ -9,6 +9,11 @@
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"state": "connected",
|
| 13 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 14 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 9 |
],
|
| 10 |
"auth_method": "oauth",
|
| 11 |
"api_key_last_4": null,
|
| 12 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 13 |
+
"client_secret_last_4": "cdef",
|
| 14 |
+
"config": {
|
| 15 |
+
"instance_url": "https://example.my.salesforce.com"
|
| 16 |
+
},
|
| 17 |
"state": "connected",
|
| 18 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 19 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
python/tests/fixtures/data_integrations_upsert_client_credentials_request.json|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"client_id": "3MVG9...",
|
| 5 |
+
"client_secret": "shhh-secret",
|
| 6 |
+
"config": {
|
| 7 |
+
"mydomain": "acme"
|
| 8 |
+
}
|
| 9 |
+
}
|
python/tests/fixtures/waitlist_user.json|
@@ -4,6 +4,7 @@
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
|
|
|
| 7 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 8 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
}
|
|
|
|
| 4 |
"email": "marcelina.davis@example.com",
|
| 5 |
"state": "pending",
|
| 6 |
"approved_at": null,
|
| 7 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 8 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 9 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 10 |
}
|
python/tests/fixtures/waitlist_user_approved.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
python/tests/fixtures/waitlist_user_created.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
python/tests/fixtures/waitlist_user_denied.json|
@@ -8,6 +8,7 @@
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
|
|
|
| 11 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 12 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 13 |
},
|
|
|
|
| 8 |
"email": "marcelina.davis@example.com",
|
| 9 |
"state": "pending",
|
| 10 |
"approved_at": null,
|
| 11 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 12 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13 |
"updated_at": "2026-01-15T12:00:00.000Z"
|
| 14 |
},
|
python/tests/test_admin_portal.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from
|
|
|
|
| 10 |
from workos._errors import (
|
| 11 |
AuthenticationError,
|
| 12 |
BadRequestError,
|
|
@@ -15,6 +14,7 @@ from workos._errors import (
|
|
| 15 |
ServerError,
|
| 16 |
UnprocessableEntityError,
|
| 17 |
)
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
class TestAdminPortal:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos.admin_portal.models import PortalLinkResponse
|
| 18 |
|
| 19 |
|
| 20 |
class TestAdminPortal:
|
python/tests/test_admin_portal_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.admin_portal.models import PortalLinkResponse
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.admin_portal.models import PortalLinkResponse
|
| 7 |
|
| 8 |
|
python/tests/test_agents.py|
@@ -3,16 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 11 |
-
AgentCredentialValidation,
|
| 12 |
-
AgentRegistration,
|
| 13 |
-
ClaimViewResponse,
|
| 14 |
-
)
|
| 15 |
-
from workos
|
| 16 |
from workos._errors import (
|
| 17 |
AuthenticationError,
|
| 18 |
BadRequestError,
|
|
@@ -21,6 +14,13 @@ from workos._errors import (
|
|
| 21 |
ServerError,
|
| 22 |
UnprocessableEntityError,
|
| 23 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
class TestAgents:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos.agents.models import (
|
| 18 |
+
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 19 |
+
AgentCredentialValidation,
|
| 20 |
+
AgentRegistration,
|
| 21 |
+
ClaimViewResponse,
|
| 22 |
+
)
|
| 23 |
+
from workos.common.models import AgentAdminValidateCredentialRequestType
|
| 24 |
|
| 25 |
|
| 26 |
class TestAgents:
|
python/tests/test_agents_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.agents.models import (
|
| 8 |
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 9 |
AgentCredentialValidation,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.agents.models import (
|
| 7 |
AgentAdminLinkClaimAttemptToExternalUserRequestUser,
|
| 8 |
AgentCredentialValidation,
|
python/tests/test_api_keys.py|
@@ -3,17 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from workos.api_keys.models import (
|
| 10 |
-
ApiKey,
|
| 11 |
-
ApiKeyValidationResponse,
|
| 12 |
-
OrganizationApiKey,
|
| 13 |
-
OrganizationApiKeyWithValue,
|
| 14 |
-
)
|
| 15 |
-
from
|
| 16 |
-
from workos
|
| 17 |
from workos._errors import (
|
| 18 |
AuthenticationError,
|
| 19 |
BadRequestError,
|
|
@@ -22,6 +14,14 @@ from workos._errors import (
|
|
| 22 |
ServerError,
|
| 23 |
UnprocessableEntityError,
|
| 24 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
class TestApiKeys:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.api_keys.models import (
|
| 19 |
+
ApiKey,
|
| 20 |
+
ApiKeyValidationResponse,
|
| 21 |
+
OrganizationApiKey,
|
| 22 |
+
OrganizationApiKeyWithValue,
|
| 23 |
+
)
|
| 24 |
+
from workos.common.models import PaginationOrder
|
| 25 |
|
| 26 |
|
| 27 |
class TestApiKeys:
|
python/tests/test_api_keys_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.api_keys.models import (
|
| 8 |
ApiKey,
|
| 9 |
ApiKeyOwner,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.api_keys.models import (
|
| 7 |
ApiKey,
|
| 8 |
ApiKeyOwner,
|
python/tests/test_audit_logs.py|
@@ -3,9 +3,18 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from workos.audit_logs.models import (
|
| 10 |
AuditLogAction,
|
| 11 |
AuditLogEvent,
|
|
@@ -15,15 +24,6 @@ from workos.audit_logs.models import (
|
|
| 15 |
)
|
| 16 |
from workos.common.models import PaginationOrder
|
| 17 |
from workos.organizations.models import AuditLogsRetention
|
| 18 |
-
from workos._pagination import AsyncPage, SyncPage
|
| 19 |
-
from workos._errors import (
|
| 20 |
-
AuthenticationError,
|
| 21 |
-
BadRequestError,
|
| 22 |
-
NotFoundError,
|
| 23 |
-
RateLimitExceededError,
|
| 24 |
-
ServerError,
|
| 25 |
-
UnprocessableEntityError,
|
| 26 |
-
)
|
| 27 |
|
| 28 |
|
| 29 |
class TestAuditLogs:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
+
from workos._errors import (
|
| 10 |
+
AuthenticationError,
|
| 11 |
+
BadRequestError,
|
| 12 |
+
NotFoundError,
|
| 13 |
+
RateLimitExceededError,
|
| 14 |
+
ServerError,
|
| 15 |
+
UnprocessableEntityError,
|
| 16 |
+
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
from workos.audit_logs.models import (
|
| 19 |
AuditLogAction,
|
| 20 |
AuditLogEvent,
|
|
|
|
| 24 |
)
|
| 25 |
from workos.common.models import PaginationOrder
|
| 26 |
from workos.organizations.models import AuditLogsRetention
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
class TestAuditLogs:
|
python/tests/test_audit_logs_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.audit_logs.models import (
|
| 8 |
AuditLogAction,
|
| 9 |
AuditLogEvent,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.audit_logs.models import (
|
| 7 |
AuditLogAction,
|
| 8 |
AuditLogEvent,
|
python/tests/test_authorization.py|
@@ -3,10 +3,25 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from workos.authorization.models import (
|
|
|
|
| 10 |
AuthorizationCheck,
|
| 11 |
AuthorizationResource,
|
| 12 |
GroupRoleAssignment,
|
|
@@ -15,26 +30,11 @@ from workos.authorization.models import (
|
|
| 15 |
Role,
|
| 16 |
RoleList,
|
| 17 |
UserRoleAssignment,
|
| 18 |
-
AuthorizationAssignment,
|
| 19 |
)
|
| 20 |
from workos.common.models import (
|
| 21 |
AuthorizationPermission,
|
| 22 |
-
UserOrganizationMembershipBaseListData,
|
| 23 |
PaginationOrder,
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
from workos._errors import (
|
| 27 |
-
AuthenticationError,
|
| 28 |
-
BadRequestError,
|
| 29 |
-
NotFoundError,
|
| 30 |
-
RateLimitExceededError,
|
| 31 |
-
ServerError,
|
| 32 |
-
UnprocessableEntityError,
|
| 33 |
-
)
|
| 34 |
-
from workos.authorization._resource import (
|
| 35 |
-
ResourceTargetById,
|
| 36 |
-
ParentResourceById,
|
| 37 |
-
ParentById,
|
| 38 |
)
|
| 39 |
|
| 40 |
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
+
from workos._errors import (
|
| 10 |
+
AuthenticationError,
|
| 11 |
+
BadRequestError,
|
| 12 |
+
NotFoundError,
|
| 13 |
+
RateLimitExceededError,
|
| 14 |
+
ServerError,
|
| 15 |
+
UnprocessableEntityError,
|
| 16 |
+
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.authorization._resource import (
|
| 19 |
+
ParentById,
|
| 20 |
+
ParentResourceById,
|
| 21 |
+
ResourceTargetById,
|
| 22 |
+
)
|
| 23 |
from workos.authorization.models import (
|
| 24 |
+
AuthorizationAssignment,
|
| 25 |
AuthorizationCheck,
|
| 26 |
AuthorizationResource,
|
| 27 |
GroupRoleAssignment,
|
|
|
|
| 30 |
Role,
|
| 31 |
RoleList,
|
| 32 |
UserRoleAssignment,
|
|
|
|
| 33 |
)
|
| 34 |
from workos.common.models import (
|
| 35 |
AuthorizationPermission,
|
|
|
|
| 36 |
PaginationOrder,
|
|
|
|
| 37 |
+
UserOrganizationMembershipBaseListData,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
)
|
| 39 |
|
| 40 |
|
python/tests/test_client_api.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
| 9 |
-
from workos
|
| 10 |
from workos._errors import (
|
| 11 |
AuthenticationError,
|
| 12 |
BadRequestError,
|
|
@@ -15,6 +14,7 @@ from workos._errors import (
|
|
| 15 |
ServerError,
|
| 16 |
UnprocessableEntityError,
|
| 17 |
)
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
class TestClientApi:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos.client_api.models import ClientApiTokenResponse
|
| 18 |
|
| 19 |
|
| 20 |
class TestClientApi:
|
python/tests/test_client_api_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.client_api.models import ClientApiTokenResponse
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.client_api.models import ClientApiTokenResponse
|
| 7 |
|
| 8 |
|
python/tests/test_common_models_round_trip.py|
@@ -26,6 +26,8 @@ from workos.common.models import (
|
|
| 26 |
AgentRegistrationExpiredData,
|
| 27 |
AgentRegistrationOrganizationSwitched,
|
| 28 |
AgentRegistrationOrganizationSwitchedData,
|
|
|
|
|
|
|
| 29 |
AgentRegistrationRevoked,
|
| 30 |
AgentRegistrationRevokedData,
|
| 31 |
ApiKeyCreated,
|
|
@@ -742,12 +744,14 @@ class TestModelRoundTrip:
|
|
| 742 |
"email": "marcelina.davis@example.com",
|
| 743 |
"state": "pending",
|
| 744 |
"approved_at": None,
|
|
|
|
| 745 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 746 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 747 |
}
|
| 748 |
instance = WaitlistUser.from_dict(data)
|
| 749 |
serialized = instance.to_dict()
|
| 750 |
assert serialized["approved_at"] is None
|
|
|
|
| 751 |
|
| 752 |
def test_waitlist_user_round_trips_unknown_enum_values(self):
|
| 753 |
data = {
|
|
@@ -756,6 +760,7 @@ class TestModelRoundTrip:
|
|
| 756 |
"email": "marcelina.davis@example.com",
|
| 757 |
"state": "unexpected_waitlist_user_state",
|
| 758 |
"approved_at": None,
|
|
|
|
| 759 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 760 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 761 |
}
|
|
@@ -1611,6 +1616,58 @@ class TestModelRoundTrip:
|
|
| 1611 |
assert serialized["from_organization_id"] == data["from_organization_id"]
|
| 1612 |
assert serialized["to_organization_id"] == data["to_organization_id"]
|
| 1613 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1614 |
def test_agent_registration_revoked_round_trip(self):
|
| 1615 |
data = load_fixture("agent_registration_revoked.json")
|
| 1616 |
instance = AgentRegistrationRevoked.from_dict(data)
|
|
@@ -13522,6 +13579,7 @@ class TestModelRoundTrip:
|
|
| 13522 |
"email": "marcelina.davis@example.com",
|
| 13523 |
"state": "pending",
|
| 13524 |
"approved_at": None,
|
|
|
|
| 13525 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13526 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13527 |
},
|
|
@@ -13546,6 +13604,7 @@ class TestModelRoundTrip:
|
|
| 13546 |
"email": "marcelina.davis@example.com",
|
| 13547 |
"state": "pending",
|
| 13548 |
"approved_at": None,
|
|
|
|
| 13549 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13550 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13551 |
},
|
|
@@ -13574,6 +13633,7 @@ class TestModelRoundTrip:
|
|
| 13574 |
"email": "marcelina.davis@example.com",
|
| 13575 |
"state": "pending",
|
| 13576 |
"approved_at": None,
|
|
|
|
| 13577 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13578 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13579 |
},
|
|
@@ -13598,6 +13658,7 @@ class TestModelRoundTrip:
|
|
| 13598 |
"email": "marcelina.davis@example.com",
|
| 13599 |
"state": "pending",
|
| 13600 |
"approved_at": None,
|
|
|
|
| 13601 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13602 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13603 |
},
|
|
@@ -13626,6 +13687,7 @@ class TestModelRoundTrip:
|
|
| 13626 |
"email": "marcelina.davis@example.com",
|
| 13627 |
"state": "pending",
|
| 13628 |
"approved_at": None,
|
|
|
|
| 13629 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13630 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13631 |
},
|
|
@@ -13650,6 +13712,7 @@ class TestModelRoundTrip:
|
|
| 13650 |
"email": "marcelina.davis@example.com",
|
| 13651 |
"state": "pending",
|
| 13652 |
"approved_at": None,
|
|
|
|
| 13653 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13654 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13655 |
},
|
|
|
|
| 26 |
AgentRegistrationExpiredData,
|
| 27 |
AgentRegistrationOrganizationSwitched,
|
| 28 |
AgentRegistrationOrganizationSwitchedData,
|
| 29 |
+
AgentRegistrationRefreshed,
|
| 30 |
+
AgentRegistrationRefreshedData,
|
| 31 |
AgentRegistrationRevoked,
|
| 32 |
AgentRegistrationRevokedData,
|
| 33 |
ApiKeyCreated,
|
|
|
|
| 744 |
"email": "marcelina.davis@example.com",
|
| 745 |
"state": "pending",
|
| 746 |
"approved_at": None,
|
| 747 |
+
"waitlist_id": None,
|
| 748 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 749 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 750 |
}
|
| 751 |
instance = WaitlistUser.from_dict(data)
|
| 752 |
serialized = instance.to_dict()
|
| 753 |
assert serialized["approved_at"] is None
|
| 754 |
+
assert serialized["waitlist_id"] is None
|
| 755 |
|
| 756 |
def test_waitlist_user_round_trips_unknown_enum_values(self):
|
| 757 |
data = {
|
|
|
|
| 760 |
"email": "marcelina.davis@example.com",
|
| 761 |
"state": "unexpected_waitlist_user_state",
|
| 762 |
"approved_at": None,
|
| 763 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 764 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 765 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 766 |
}
|
|
|
|
| 1616 |
assert serialized["from_organization_id"] == data["from_organization_id"]
|
| 1617 |
assert serialized["to_organization_id"] == data["to_organization_id"]
|
| 1618 |
|
| 1619 |
+
def test_agent_registration_refreshed_round_trip(self):
|
| 1620 |
+
data = load_fixture("agent_registration_refreshed.json")
|
| 1621 |
+
instance = AgentRegistrationRefreshed.from_dict(data)
|
| 1622 |
+
serialized = instance.to_dict()
|
| 1623 |
+
assert serialized == data
|
| 1624 |
+
restored = AgentRegistrationRefreshed.from_dict(serialized)
|
| 1625 |
+
assert restored.to_dict() == serialized
|
| 1626 |
+
|
| 1627 |
+
def test_agent_registration_refreshed_minimal_payload(self):
|
| 1628 |
+
data = {
|
| 1629 |
+
"object": "event",
|
| 1630 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 1631 |
+
"event": "agent.registration.refreshed",
|
| 1632 |
+
"data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
|
| 1633 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 1634 |
+
}
|
| 1635 |
+
instance = AgentRegistrationRefreshed.from_dict(data)
|
| 1636 |
+
serialized = instance.to_dict()
|
| 1637 |
+
assert serialized["object"] == data["object"]
|
| 1638 |
+
assert serialized["id"] == data["id"]
|
| 1639 |
+
assert serialized["event"] == data["event"]
|
| 1640 |
+
assert serialized["data"] == data["data"]
|
| 1641 |
+
assert serialized["created_at"] == data["created_at"]
|
| 1642 |
+
|
| 1643 |
+
def test_agent_registration_refreshed_omits_absent_optional_non_nullable_fields(
|
| 1644 |
+
self,
|
| 1645 |
+
):
|
| 1646 |
+
data = {
|
| 1647 |
+
"object": "event",
|
| 1648 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 1649 |
+
"event": "agent.registration.refreshed",
|
| 1650 |
+
"data": {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"},
|
| 1651 |
+
"created_at": "2026-01-15T12:00:00.000Z",
|
| 1652 |
+
}
|
| 1653 |
+
instance = AgentRegistrationRefreshed.from_dict(data)
|
| 1654 |
+
serialized = instance.to_dict()
|
| 1655 |
+
assert "context" not in serialized
|
| 1656 |
+
|
| 1657 |
+
def test_agent_registration_refreshed_data_round_trip(self):
|
| 1658 |
+
data = load_fixture("agent_registration_refreshed_data.json")
|
| 1659 |
+
instance = AgentRegistrationRefreshedData.from_dict(data)
|
| 1660 |
+
serialized = instance.to_dict()
|
| 1661 |
+
assert serialized == data
|
| 1662 |
+
restored = AgentRegistrationRefreshedData.from_dict(serialized)
|
| 1663 |
+
assert restored.to_dict() == serialized
|
| 1664 |
+
|
| 1665 |
+
def test_agent_registration_refreshed_data_minimal_payload(self):
|
| 1666 |
+
data = {"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"}
|
| 1667 |
+
instance = AgentRegistrationRefreshedData.from_dict(data)
|
| 1668 |
+
serialized = instance.to_dict()
|
| 1669 |
+
assert serialized["agent_registration_id"] == data["agent_registration_id"]
|
| 1670 |
+
|
| 1671 |
def test_agent_registration_revoked_round_trip(self):
|
| 1672 |
data = load_fixture("agent_registration_revoked.json")
|
| 1673 |
instance = AgentRegistrationRevoked.from_dict(data)
|
|
|
|
| 13579 |
"email": "marcelina.davis@example.com",
|
| 13580 |
"state": "pending",
|
| 13581 |
"approved_at": None,
|
| 13582 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13583 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13584 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13585 |
},
|
|
|
|
| 13604 |
"email": "marcelina.davis@example.com",
|
| 13605 |
"state": "pending",
|
| 13606 |
"approved_at": None,
|
| 13607 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13608 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13609 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13610 |
},
|
|
|
|
| 13633 |
"email": "marcelina.davis@example.com",
|
| 13634 |
"state": "pending",
|
| 13635 |
"approved_at": None,
|
| 13636 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13637 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13638 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13639 |
},
|
|
|
|
| 13658 |
"email": "marcelina.davis@example.com",
|
| 13659 |
"state": "pending",
|
| 13660 |
"approved_at": None,
|
| 13661 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13662 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13663 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13664 |
},
|
|
|
|
| 13687 |
"email": "marcelina.davis@example.com",
|
| 13688 |
"state": "pending",
|
| 13689 |
"approved_at": None,
|
| 13690 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13691 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13692 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13693 |
},
|
|
|
|
| 13712 |
"email": "marcelina.davis@example.com",
|
| 13713 |
"state": "pending",
|
| 13714 |
"approved_at": None,
|
| 13715 |
+
"waitlist_id": "waitlist_01E4ZCR3C56J083X43JQXF3JK5",
|
| 13716 |
"created_at": "2026-01-15T12:00:00.000Z",
|
| 13717 |
"updated_at": "2026-01-15T12:00:00.000Z",
|
| 13718 |
},
|
python/tests/test_connect.py|
@@ -3,17 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from workos.common.models import ConnectApplicationOAuth, PaginationOrder
|
| 10 |
-
from
|
| 11 |
-
ApplicationCredentialsListItem,
|
| 12 |
-
ExternalAuthCompleteResponse,
|
| 13 |
-
NewConnectApplicationSecret,
|
| 14 |
-
UserObject,
|
| 15 |
-
)
|
| 16 |
-
from workos
|
| 17 |
from workos._errors import (
|
| 18 |
AuthenticationError,
|
| 19 |
BadRequestError,
|
|
@@ -22,6 +14,17 @@ from workos._errors import (
|
|
| 22 |
ServerError,
|
| 23 |
UnprocessableEntityError,
|
| 24 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
class TestConnect:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.common.models import (
|
| 19 |
+
ConnectApplicationOAuth,
|
| 20 |
+
PaginationOrder,
|
| 21 |
+
)
|
| 22 |
+
from workos.connect.models import (
|
| 23 |
+
ApplicationCredentialsListItem,
|
| 24 |
+
ExternalAuthCompleteResponse,
|
| 25 |
+
NewConnectApplicationSecret,
|
| 26 |
+
UserObject,
|
| 27 |
+
)
|
| 28 |
|
| 29 |
|
| 30 |
class TestConnect:
|
python/tests/test_directory_sync.py|
@@ -2,12 +2,9 @@
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
| 5 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 6 |
-
from tests.generated_helpers import load_fixture
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from workos.directory_sync.models import Directory, DirectoryUserWithGroups
|
| 10 |
-
from workos
|
| 11 |
from workos._errors import (
|
| 12 |
AuthenticationError,
|
| 13 |
BadRequestError,
|
|
@@ -16,6 +13,9 @@ from workos._errors import (
|
|
| 16 |
ServerError,
|
| 17 |
UnprocessableEntityError,
|
| 18 |
)
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
class TestDirectorySync:
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
| 7 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 8 |
from workos._errors import (
|
| 9 |
AuthenticationError,
|
| 10 |
BadRequestError,
|
|
|
|
| 13 |
ServerError,
|
| 14 |
UnprocessableEntityError,
|
| 15 |
)
|
| 16 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 17 |
+
from workos.common.models import DirectoryGroup, PaginationOrder
|
| 18 |
+
from workos.directory_sync.models import Directory, DirectoryUserWithGroups
|
| 19 |
|
| 20 |
|
| 21 |
class TestDirectorySync:
|
python/tests/test_directory_sync_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.directory_sync.models import (
|
| 8 |
Directory,
|
| 9 |
DirectoryGroup,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.directory_sync.models import (
|
| 7 |
Directory,
|
| 8 |
DirectoryGroup,
|
python/tests/test_events.py|
@@ -2,11 +2,9 @@
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
| 5 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 6 |
-
from tests.generated_helpers import load_fixture
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from workos
|
| 10 |
from workos._errors import (
|
| 11 |
AuthenticationError,
|
| 12 |
BadRequestError,
|
|
@@ -15,6 +13,8 @@ from workos._errors import (
|
|
| 15 |
ServerError,
|
| 16 |
UnprocessableEntityError,
|
| 17 |
)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
class TestEvents:
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
from tests.generated_helpers import load_fixture
|
| 7 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 8 |
from workos._errors import (
|
| 9 |
AuthenticationError,
|
| 10 |
BadRequestError,
|
|
|
|
| 13 |
ServerError,
|
| 14 |
UnprocessableEntityError,
|
| 15 |
)
|
| 16 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 17 |
+
from workos.common.models import ActionAuthenticationDenied, PaginationOrder
|
| 18 |
|
| 19 |
|
| 20 |
class TestEvents:
|
python/tests/test_events_models_round_trip.py|
@@ -5,7 +5,6 @@
|
|
| 5 |
import pytest
|
| 6 |
|
| 7 |
from tests.generated_helpers import load_fixture
|
| 8 |
-
|
| 9 |
from workos.common.models import ActionAuthenticationDenied
|
| 10 |
from workos.events.models import EventListListMetadata, EventSchema, EventSchemaUnknown
|
| 11 |
|
|
|
|
| 5 |
import pytest
|
| 6 |
|
| 7 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 8 |
from workos.common.models import ActionAuthenticationDenied
|
| 9 |
from workos.events.models import EventListListMetadata, EventSchema, EventSchemaUnknown
|
| 10 |
|
python/tests/test_feature_flags.py|
@@ -2,11 +2,9 @@
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
| 5 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 6 |
-
from tests.generated_helpers import load_fixture
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from workos
|
| 10 |
from workos._errors import (
|
| 11 |
AuthenticationError,
|
| 12 |
BadRequestError,
|
|
@@ -15,6 +13,8 @@ from workos._errors import (
|
|
| 15 |
ServerError,
|
| 16 |
UnprocessableEntityError,
|
| 17 |
)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
class TestFeatureFlags:
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
from tests.generated_helpers import load_fixture
|
| 7 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 8 |
from workos._errors import (
|
| 9 |
AuthenticationError,
|
| 10 |
BadRequestError,
|
|
|
|
| 13 |
ServerError,
|
| 14 |
UnprocessableEntityError,
|
| 15 |
)
|
| 16 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 17 |
+
from workos.common.models import FeatureFlag, Flag, PaginationOrder
|
| 18 |
|
| 19 |
|
| 20 |
class TestFeatureFlags:
|
python/tests/test_feature_flags_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.feature_flags.models import FeatureFlag, FeatureFlagOwner, Flag, FlagOwner
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.feature_flags.models import FeatureFlag, FeatureFlagOwner, Flag, FlagOwner
|
| 7 |
|
| 8 |
|
python/tests/test_groups.py|
@@ -3,15 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
Group,
|
| 11 |
-
UserOrganizationMembershipBaseListData,
|
| 12 |
-
PaginationOrder,
|
| 13 |
-
)
|
| 14 |
-
from workos
|
| 15 |
from workos._errors import (
|
| 16 |
AuthenticationError,
|
| 17 |
BadRequestError,
|
|
@@ -20,6 +14,12 @@ from workos._errors import (
|
|
| 20 |
ServerError,
|
| 21 |
UnprocessableEntityError,
|
| 22 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
class TestGroups:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.common.models import (
|
| 19 |
+
Group,
|
| 20 |
+
PaginationOrder,
|
| 21 |
+
UserOrganizationMembershipBaseListData,
|
| 22 |
+
)
|
| 23 |
|
| 24 |
|
| 25 |
class TestGroups:
|
python/tests/test_groups_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.groups.models import Group, UserOrganizationMembershipBaseListData
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.groups.models import Group, UserOrganizationMembershipBaseListData
|
| 7 |
|
| 8 |
|
python/tests/test_multi_factor_auth.py|
@@ -3,9 +3,18 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from workos.common.models import (
|
| 10 |
AuthenticationChallenge,
|
| 11 |
AuthenticationFactor,
|
|
@@ -17,15 +26,6 @@ from workos.multi_factor_auth.models import (
|
|
| 17 |
AuthenticationChallengeVerifyResponse,
|
| 18 |
UserAuthenticationFactorEnrollResponse,
|
| 19 |
)
|
| 20 |
-
from workos._pagination import AsyncPage, SyncPage
|
| 21 |
-
from workos._errors import (
|
| 22 |
-
AuthenticationError,
|
| 23 |
-
BadRequestError,
|
| 24 |
-
NotFoundError,
|
| 25 |
-
RateLimitExceededError,
|
| 26 |
-
ServerError,
|
| 27 |
-
UnprocessableEntityError,
|
| 28 |
-
)
|
| 29 |
|
| 30 |
|
| 31 |
class TestMultiFactorAuth:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
+
from workos._errors import (
|
| 10 |
+
AuthenticationError,
|
| 11 |
+
BadRequestError,
|
| 12 |
+
NotFoundError,
|
| 13 |
+
RateLimitExceededError,
|
| 14 |
+
ServerError,
|
| 15 |
+
UnprocessableEntityError,
|
| 16 |
+
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
from workos.common.models import (
|
| 19 |
AuthenticationChallenge,
|
| 20 |
AuthenticationFactor,
|
|
|
|
| 26 |
AuthenticationChallengeVerifyResponse,
|
| 27 |
UserAuthenticationFactorEnrollResponse,
|
| 28 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
class TestMultiFactorAuth:
|
python/tests/test_multi_factor_auth_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.multi_factor_auth.models import (
|
| 8 |
AuthenticationChallenge,
|
| 9 |
AuthenticationChallengeVerifyResponse,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.multi_factor_auth.models import (
|
| 7 |
AuthenticationChallenge,
|
| 8 |
AuthenticationChallengeVerifyResponse,
|
python/tests/test_organization_domains.py|
@@ -3,10 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
| 9 |
-
from workos
|
| 10 |
from workos._errors import (
|
| 11 |
AuthenticationError,
|
| 12 |
BadRequestError,
|
|
@@ -15,6 +14,7 @@ from workos._errors import (
|
|
| 15 |
ServerError,
|
| 16 |
UnprocessableEntityError,
|
| 17 |
)
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
class TestOrganizationDomains:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos.common.models import OrganizationDomain
|
| 18 |
|
| 19 |
|
| 20 |
class TestOrganizationDomains:
|
python/tests/test_organization_domains_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.organization_domains.models import OrganizationDomain
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.organization_domains.models import OrganizationDomain
|
| 7 |
|
| 8 |
|
python/tests/test_organization_membership.py|
@@ -3,15 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from workos.common.models import Group, PaginationOrder
|
| 10 |
-
from
|
| 11 |
-
OrganizationMembership,
|
| 12 |
-
UserOrganizationMembership,
|
| 13 |
-
)
|
| 14 |
-
from workos
|
| 15 |
from workos._errors import (
|
| 16 |
AuthenticationError,
|
| 17 |
BadRequestError,
|
|
@@ -20,7 +14,13 @@ from workos._errors import (
|
|
| 20 |
ServerError,
|
| 21 |
UnprocessableEntityError,
|
| 22 |
)
|
|
|
|
|
|
|
| 23 |
from workos.organization_membership._resource import RoleSingle
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
class TestOrganizationMembership:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
|
|
|
|
|
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.common.models import Group, PaginationOrder
|
| 19 |
from workos.organization_membership._resource import RoleSingle
|
| 20 |
+
from workos.organization_membership.models import (
|
| 21 |
+
OrganizationMembership,
|
| 22 |
+
UserOrganizationMembership,
|
| 23 |
+
)
|
| 24 |
|
| 25 |
|
| 26 |
class TestOrganizationMembership:
|
python/tests/test_organization_membership_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.organization_membership.models import (
|
| 8 |
OrganizationMembership,
|
| 9 |
UserOrganizationMembership,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.organization_membership.models import (
|
| 7 |
OrganizationMembership,
|
| 8 |
UserOrganizationMembership,
|
python/tests/test_organizations.py|
@@ -3,16 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
from workos.organizations.models import (
|
| 11 |
-
AuditLogConfiguration,
|
| 12 |
-
Organization,
|
| 13 |
-
OrganizationAuthorizedConnectApplicationListData,
|
| 14 |
-
)
|
| 15 |
-
from workos
|
| 16 |
from workos._errors import (
|
| 17 |
AuthenticationError,
|
| 18 |
BadRequestError,
|
|
@@ -21,6 +14,13 @@ from workos._errors import (
|
|
| 21 |
ServerError,
|
| 22 |
UnprocessableEntityError,
|
| 23 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
class TestOrganizations:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.common.models import PaginationOrder
|
| 19 |
+
from workos.organizations.models import (
|
| 20 |
+
AuditLogConfiguration,
|
| 21 |
+
Organization,
|
| 22 |
+
OrganizationAuthorizedConnectApplicationListData,
|
| 23 |
+
)
|
| 24 |
|
| 25 |
|
| 26 |
class TestOrganizations:
|
python/tests/test_organizations_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.organizations.models import (
|
| 8 |
AuditLogConfiguration,
|
| 9 |
AuditLogConfigurationLogStream,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.organizations.models import (
|
| 7 |
AuditLogConfiguration,
|
| 8 |
AuditLogConfigurationLogStream,
|
python/tests/test_pipes.py|
@@ -139,6 +139,29 @@ class TestPipes:
|
|
| 139 |
body = json.loads(request.content)
|
| 140 |
assert body["user_id"] == "test_user_id"
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
def test_create_data_integration_credential(self, workos, httpx_mock):
|
| 143 |
httpx_mock.add_response(
|
| 144 |
json=load_fixture("data_integration_credentials_response.json"),
|
|
@@ -465,6 +488,26 @@ class TestAsyncPipes:
|
|
| 465 |
assert request.method == "POST"
|
| 466 |
assert request.url.path.endswith("/data-integrations/test_slug/authorize")
|
| 467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 468 |
@pytest.mark.asyncio
|
| 469 |
async def test_create_data_integration_credential(self, async_workos, httpx_mock):
|
| 470 |
httpx_mock.add_response(
|
|
|
|
| 139 |
body = json.loads(request.content)
|
| 140 |
assert body["user_id"] == "test_user_id"
|
| 141 |
|
| 142 |
+
def test_update_data_integration_client_credentials(self, workos, httpx_mock):
|
| 143 |
+
httpx_mock.add_response(
|
| 144 |
+
json=load_fixture("connected_account.json"),
|
| 145 |
+
)
|
| 146 |
+
result = workos.pipes.update_data_integration_client_credentials(
|
| 147 |
+
"test_slug",
|
| 148 |
+
user_id="test_user_id",
|
| 149 |
+
client_id="test_client_id",
|
| 150 |
+
client_secret="test_client_secret",
|
| 151 |
+
)
|
| 152 |
+
assert isinstance(result, ConnectedAccount)
|
| 153 |
+
assert result.object == "connected_account"
|
| 154 |
+
assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
| 155 |
+
request = httpx_mock.get_request()
|
| 156 |
+
assert request.method == "PUT"
|
| 157 |
+
assert request.url.path.endswith(
|
| 158 |
+
"/data-integrations/test_slug/client-credentials"
|
| 159 |
+
)
|
| 160 |
+
body = json.loads(request.content)
|
| 161 |
+
assert body["user_id"] == "test_user_id"
|
| 162 |
+
assert body["client_id"] == "test_client_id"
|
| 163 |
+
assert body["client_secret"] == "test_client_secret"
|
| 164 |
+
|
| 165 |
def test_create_data_integration_credential(self, workos, httpx_mock):
|
| 166 |
httpx_mock.add_response(
|
| 167 |
json=load_fixture("data_integration_credentials_response.json"),
|
|
|
|
| 488 |
assert request.method == "POST"
|
| 489 |
assert request.url.path.endswith("/data-integrations/test_slug/authorize")
|
| 490 |
|
| 491 |
+
@pytest.mark.asyncio
|
| 492 |
+
async def test_update_data_integration_client_credentials(
|
| 493 |
+
self, async_workos, httpx_mock
|
| 494 |
+
):
|
| 495 |
+
httpx_mock.add_response(json=load_fixture("connected_account.json"))
|
| 496 |
+
result = await async_workos.pipes.update_data_integration_client_credentials(
|
| 497 |
+
"test_slug",
|
| 498 |
+
user_id="test_user_id",
|
| 499 |
+
client_id="test_client_id",
|
| 500 |
+
client_secret="test_client_secret",
|
| 501 |
+
)
|
| 502 |
+
assert isinstance(result, ConnectedAccount)
|
| 503 |
+
assert result.object == "connected_account"
|
| 504 |
+
assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT"
|
| 505 |
+
request = httpx_mock.get_request()
|
| 506 |
+
assert request.method == "PUT"
|
| 507 |
+
assert request.url.path.endswith(
|
| 508 |
+
"/data-integrations/test_slug/client-credentials"
|
| 509 |
+
)
|
| 510 |
+
|
| 511 |
@pytest.mark.asyncio
|
| 512 |
async def test_create_data_integration_credential(self, async_workos, httpx_mock):
|
| 513 |
httpx_mock.add_response(
|
python/tests/test_pipes_models_round_trip.py|
@@ -93,26 +93,20 @@ class TestModelRoundTrip:
|
|
| 93 |
assert restored.to_dict() == serialized
|
| 94 |
|
| 95 |
def test_custom_provider_definition_minimal_payload(self):
|
| 96 |
-
data = {
|
| 97 |
-
|
| 98 |
-
"authorization_url": "https://provider.example.com/oauth/authorize",
|
| 99 |
-
"token_url": "https://provider.example.com/oauth/token",
|
| 100 |
-
}
|
| 101 |
instance = CustomProviderDefinition.from_dict(data)
|
| 102 |
serialized = instance.to_dict()
|
| 103 |
assert serialized["name"] == data["name"]
|
| 104 |
-
assert serialized["authorization_url"] == data["authorization_url"]
|
| 105 |
-
assert serialized["token_url"] == data["token_url"]
|
| 106 |
|
| 107 |
def test_custom_provider_definition_omits_absent_optional_non_nullable_fields(self):
|
| 108 |
data = {
|
| 109 |
"name": "My OAuth App",
|
| 110 |
-
"authorization_url": "https://provider.example.com/oauth/authorize",
|
| 111 |
-
"token_url": "https://provider.example.com/oauth/token",
|
| 112 |
"refresh_token_url": "https://provider.example.com/oauth/token",
|
| 113 |
}
|
| 114 |
instance = CustomProviderDefinition.from_dict(data)
|
| 115 |
serialized = instance.to_dict()
|
|
|
|
|
|
|
| 116 |
assert "pkce_enabled" not in serialized
|
| 117 |
assert "request_scope_separator" not in serialized
|
| 118 |
assert "scopes_required" not in serialized
|
|
@@ -241,11 +235,7 @@ class TestModelRoundTrip:
|
|
| 241 |
"scopes": None,
|
| 242 |
"redirect_uri": "https://api.workos.com/data-integrations/github/dik_01EHZNVPK3SFK441A1RGBFSHRT/callback",
|
| 243 |
"auth_methods": ["oauth"],
|
| 244 |
-
"credentials":
|
| 245 |
-
"type": "custom",
|
| 246 |
-
"client_id": "Iv1.abc123",
|
| 247 |
-
"redacted_client_secret": "6789",
|
| 248 |
-
},
|
| 249 |
"installation": None,
|
| 250 |
"config": {"account_identifier": "acme-prod"},
|
| 251 |
"custom_provider": None,
|
|
@@ -283,11 +273,7 @@ class TestModelRoundTrip:
|
|
| 283 |
"scopes": None,
|
| 284 |
"redirect_uri": "https://api.workos.com/data-integrations/github/dik_01EHZNVPK3SFK441A1RGBFSHRT/callback",
|
| 285 |
"auth_methods": ["oauth"],
|
| 286 |
-
"credentials":
|
| 287 |
-
"type": "custom",
|
| 288 |
-
"client_id": "Iv1.abc123",
|
| 289 |
-
"redacted_client_secret": "6789",
|
| 290 |
-
},
|
| 291 |
"installation": None,
|
| 292 |
"config": {"account_identifier": "acme-prod"},
|
| 293 |
"custom_provider": None,
|
|
@@ -298,6 +284,7 @@ class TestModelRoundTrip:
|
|
| 298 |
serialized = instance.to_dict()
|
| 299 |
assert serialized["description"] is None
|
| 300 |
assert serialized["scopes"] is None
|
|
|
|
| 301 |
assert serialized["installation"] is None
|
| 302 |
assert serialized["custom_provider"] is None
|
| 303 |
|
|
@@ -474,6 +461,8 @@ class TestModelRoundTrip:
|
|
| 474 |
"organization_id": None,
|
| 475 |
"scopes": ["repo", "user:email"],
|
| 476 |
"api_key_last_4": None,
|
|
|
|
|
|
|
| 477 |
"state": "connected",
|
| 478 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 479 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -481,6 +470,7 @@ class TestModelRoundTrip:
|
|
| 481 |
instance = ConnectedAccount.from_dict(data)
|
| 482 |
serialized = instance.to_dict()
|
| 483 |
assert "auth_method" not in serialized
|
|
|
|
| 484 |
|
| 485 |
def test_connected_account_preserves_nullable_fields(self):
|
| 486 |
data = {
|
|
@@ -491,6 +481,9 @@ class TestModelRoundTrip:
|
|
| 491 |
"scopes": ["repo", "user:email"],
|
| 492 |
"auth_method": "oauth",
|
| 493 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 494 |
"state": "connected",
|
| 495 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 496 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -500,6 +493,8 @@ class TestModelRoundTrip:
|
|
| 500 |
assert serialized["user_id"] is None
|
| 501 |
assert serialized["organization_id"] is None
|
| 502 |
assert serialized["api_key_last_4"] is None
|
|
|
|
|
|
|
| 503 |
|
| 504 |
def test_connected_account_round_trips_unknown_enum_values(self):
|
| 505 |
data = {
|
|
@@ -510,6 +505,9 @@ class TestModelRoundTrip:
|
|
| 510 |
"scopes": ["repo", "user:email"],
|
| 511 |
"auth_method": "unexpected_connected_account_auth_method",
|
| 512 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 513 |
"state": "connected",
|
| 514 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 515 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -550,6 +548,9 @@ class TestModelRoundTrip:
|
|
| 550 |
"scopes": ["repo", "user:email"],
|
| 551 |
"auth_method": "oauth",
|
| 552 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 553 |
"state": "connected",
|
| 554 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 555 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -624,6 +625,9 @@ class TestModelRoundTrip:
|
|
| 624 |
"scopes": ["repo", "user:email"],
|
| 625 |
"auth_method": "oauth",
|
| 626 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 627 |
"state": "connected",
|
| 628 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 629 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -678,6 +682,9 @@ class TestModelRoundTrip:
|
|
| 678 |
"scopes": ["repo", "user:email"],
|
| 679 |
"auth_method": "oauth",
|
| 680 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 681 |
"state": "connected",
|
| 682 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 683 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -956,6 +963,8 @@ class TestModelRoundTrip:
|
|
| 956 |
"organization_id": None,
|
| 957 |
"scopes": ["repo", "user:email"],
|
| 958 |
"api_key_last_4": None,
|
|
|
|
|
|
|
| 959 |
"state": "connected",
|
| 960 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 961 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -964,6 +973,7 @@ class TestModelRoundTrip:
|
|
| 964 |
instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data)
|
| 965 |
serialized = instance.to_dict()
|
| 966 |
assert "auth_method" not in serialized
|
|
|
|
| 967 |
|
| 968 |
def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields(
|
| 969 |
self,
|
|
@@ -976,6 +986,9 @@ class TestModelRoundTrip:
|
|
| 976 |
"scopes": ["repo", "user:email"],
|
| 977 |
"auth_method": "oauth",
|
| 978 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 979 |
"state": "connected",
|
| 980 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 981 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
@@ -986,6 +999,8 @@ class TestModelRoundTrip:
|
|
| 986 |
assert serialized["user_id"] is None
|
| 987 |
assert serialized["organization_id"] is None
|
| 988 |
assert serialized["api_key_last_4"] is None
|
|
|
|
|
|
|
| 989 |
assert serialized["userlandUserId"] is None
|
| 990 |
|
| 991 |
def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values(
|
|
@@ -999,6 +1014,9 @@ class TestModelRoundTrip:
|
|
| 999 |
"scopes": ["repo", "user:email"],
|
| 1000 |
"auth_method": "unexpected_data_integrations_list_response_data_connected_account_auth_method",
|
| 1001 |
"api_key_last_4": None,
|
|
|
|
|
|
|
|
|
|
| 1002 |
"state": "connected",
|
| 1003 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 1004 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 93 |
assert restored.to_dict() == serialized
|
| 94 |
|
| 95 |
def test_custom_provider_definition_minimal_payload(self):
|
|
|
|
| 96 |
+
data = {"name": "My OAuth App"}
|
|
|
|
|
|
|
|
|
|
| 97 |
instance = CustomProviderDefinition.from_dict(data)
|
| 98 |
serialized = instance.to_dict()
|
| 99 |
assert serialized["name"] == data["name"]
|
|
|
|
|
|
|
| 100 |
|
| 101 |
def test_custom_provider_definition_omits_absent_optional_non_nullable_fields(self):
|
| 102 |
data = {
|
| 103 |
"name": "My OAuth App",
|
|
|
|
|
|
|
| 104 |
"refresh_token_url": "https://provider.example.com/oauth/token",
|
| 105 |
}
|
| 106 |
instance = CustomProviderDefinition.from_dict(data)
|
| 107 |
serialized = instance.to_dict()
|
| 108 |
+
assert "authorization_url" not in serialized
|
| 109 |
+
assert "token_url" not in serialized
|
| 110 |
assert "pkce_enabled" not in serialized
|
| 111 |
assert "request_scope_separator" not in serialized
|
| 112 |
assert "scopes_required" not in serialized
|
|
|
|
| 235 |
"scopes": None,
|
| 236 |
"redirect_uri": "https://api.workos.com/data-integrations/github/dik_01EHZNVPK3SFK441A1RGBFSHRT/callback",
|
| 237 |
"auth_methods": ["oauth"],
|
| 238 |
+
"credentials": None,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
"installation": None,
|
| 240 |
"config": {"account_identifier": "acme-prod"},
|
| 241 |
"custom_provider": None,
|
|
|
|
| 273 |
"scopes": None,
|
| 274 |
"redirect_uri": "https://api.workos.com/data-integrations/github/dik_01EHZNVPK3SFK441A1RGBFSHRT/callback",
|
| 275 |
"auth_methods": ["oauth"],
|
| 276 |
+
"credentials": None,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
"installation": None,
|
| 278 |
"config": {"account_identifier": "acme-prod"},
|
| 279 |
"custom_provider": None,
|
|
|
|
| 284 |
serialized = instance.to_dict()
|
| 285 |
assert serialized["description"] is None
|
| 286 |
assert serialized["scopes"] is None
|
| 287 |
+
assert serialized["credentials"] is None
|
| 288 |
assert serialized["installation"] is None
|
| 289 |
assert serialized["custom_provider"] is None
|
| 290 |
|
|
|
|
| 461 |
"organization_id": None,
|
| 462 |
"scopes": ["repo", "user:email"],
|
| 463 |
"api_key_last_4": None,
|
| 464 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 465 |
+
"client_secret_last_4": "cdef",
|
| 466 |
"state": "connected",
|
| 467 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 468 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 470 |
instance = ConnectedAccount.from_dict(data)
|
| 471 |
serialized = instance.to_dict()
|
| 472 |
assert "auth_method" not in serialized
|
| 473 |
+
assert "config" not in serialized
|
| 474 |
|
| 475 |
def test_connected_account_preserves_nullable_fields(self):
|
| 476 |
data = {
|
|
|
|
| 481 |
"scopes": ["repo", "user:email"],
|
| 482 |
"auth_method": "oauth",
|
| 483 |
"api_key_last_4": None,
|
| 484 |
+
"client_id": None,
|
| 485 |
+
"client_secret_last_4": None,
|
| 486 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 487 |
"state": "connected",
|
| 488 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 489 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 493 |
assert serialized["user_id"] is None
|
| 494 |
assert serialized["organization_id"] is None
|
| 495 |
assert serialized["api_key_last_4"] is None
|
| 496 |
+
assert serialized["client_id"] is None
|
| 497 |
+
assert serialized["client_secret_last_4"] is None
|
| 498 |
|
| 499 |
def test_connected_account_round_trips_unknown_enum_values(self):
|
| 500 |
data = {
|
|
|
|
| 505 |
"scopes": ["repo", "user:email"],
|
| 506 |
"auth_method": "unexpected_connected_account_auth_method",
|
| 507 |
"api_key_last_4": None,
|
| 508 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 509 |
+
"client_secret_last_4": "cdef",
|
| 510 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 511 |
"state": "connected",
|
| 512 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 513 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 548 |
"scopes": ["repo", "user:email"],
|
| 549 |
"auth_method": "oauth",
|
| 550 |
"api_key_last_4": None,
|
| 551 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 552 |
+
"client_secret_last_4": "cdef",
|
| 553 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 554 |
"state": "connected",
|
| 555 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 556 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 625 |
"scopes": ["repo", "user:email"],
|
| 626 |
"auth_method": "oauth",
|
| 627 |
"api_key_last_4": None,
|
| 628 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 629 |
+
"client_secret_last_4": "cdef",
|
| 630 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 631 |
"state": "connected",
|
| 632 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 633 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 682 |
"scopes": ["repo", "user:email"],
|
| 683 |
"auth_method": "oauth",
|
| 684 |
"api_key_last_4": None,
|
| 685 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 686 |
+
"client_secret_last_4": "cdef",
|
| 687 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 688 |
"state": "connected",
|
| 689 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 690 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 963 |
"organization_id": None,
|
| 964 |
"scopes": ["repo", "user:email"],
|
| 965 |
"api_key_last_4": None,
|
| 966 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 967 |
+
"client_secret_last_4": "cdef",
|
| 968 |
"state": "connected",
|
| 969 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 970 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 973 |
instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data)
|
| 974 |
serialized = instance.to_dict()
|
| 975 |
assert "auth_method" not in serialized
|
| 976 |
+
assert "config" not in serialized
|
| 977 |
|
| 978 |
def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields(
|
| 979 |
self,
|
|
|
|
| 986 |
"scopes": ["repo", "user:email"],
|
| 987 |
"auth_method": "oauth",
|
| 988 |
"api_key_last_4": None,
|
| 989 |
+
"client_id": None,
|
| 990 |
+
"client_secret_last_4": None,
|
| 991 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 992 |
"state": "connected",
|
| 993 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 994 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
|
|
|
| 999 |
assert serialized["user_id"] is None
|
| 1000 |
assert serialized["organization_id"] is None
|
| 1001 |
assert serialized["api_key_last_4"] is None
|
| 1002 |
+
assert serialized["client_id"] is None
|
| 1003 |
+
assert serialized["client_secret_last_4"] is None
|
| 1004 |
assert serialized["userlandUserId"] is None
|
| 1005 |
|
| 1006 |
def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values(
|
|
|
|
| 1014 |
"scopes": ["repo", "user:email"],
|
| 1015 |
"auth_method": "unexpected_data_integrations_list_response_data_connected_account_auth_method",
|
| 1016 |
"api_key_last_4": None,
|
| 1017 |
+
"client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc",
|
| 1018 |
+
"client_secret_last_4": "cdef",
|
| 1019 |
+
"config": {"instance_url": "https://example.my.salesforce.com"},
|
| 1020 |
"state": "connected",
|
| 1021 |
"created_at": "2024-01-16T14:20:00.000Z",
|
| 1022 |
"updated_at": "2024-01-16T14:20:00.000Z",
|
python/tests/test_radar.py|
@@ -3,17 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from workos.common.models import (
|
| 10 |
-
RadarStandaloneAssessRequestAction,
|
| 11 |
-
RadarStandaloneAssessRequestAuthMethod,
|
| 12 |
-
)
|
| 13 |
-
from
|
| 14 |
-
|
| 15 |
-
RadarStandaloneResponse,
|
| 16 |
-
)
|
| 17 |
from workos._errors import (
|
| 18 |
AuthenticationError,
|
| 19 |
BadRequestError,
|
|
@@ -22,6 +14,14 @@ from workos._errors import (
|
|
| 22 |
ServerError,
|
| 23 |
UnprocessableEntityError,
|
| 24 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
class TestRadar:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
|
|
|
|
|
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos.common.models import (
|
| 18 |
+
RadarStandaloneAssessRequestAction,
|
| 19 |
+
RadarStandaloneAssessRequestAuthMethod,
|
| 20 |
+
)
|
| 21 |
+
from workos.radar.models import (
|
| 22 |
+
RadarListEntryAlreadyPresentResponse,
|
| 23 |
+
RadarStandaloneResponse,
|
| 24 |
+
)
|
| 25 |
|
| 26 |
|
| 27 |
class TestRadar:
|
python/tests/test_radar_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.radar.models import (
|
| 8 |
RadarListEntryAlreadyPresentResponse,
|
| 9 |
RadarStandaloneResponse,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.radar.models import (
|
| 7 |
RadarListEntryAlreadyPresentResponse,
|
| 8 |
RadarStandaloneResponse,
|
python/tests/test_user_management.py|
@@ -858,8 +858,6 @@ class TestUserManagement:
|
|
| 858 |
httpx_mock.add_response(json=load_fixture("authenticate_response.json"))
|
| 859 |
result = workos.user_management.authenticate_with_radar_sms_challenge(
|
| 860 |
code="test_code",
|
| 861 |
-
verification_id="test_verification_id",
|
| 862 |
-
phone_number="test_phone_number",
|
| 863 |
pending_authentication_token="test_pending_authentication_token",
|
| 864 |
)
|
| 865 |
assert isinstance(result, AuthenticateResponse)
|
|
@@ -1766,8 +1764,6 @@ class TestAsyncUserManagement:
|
|
| 1766 |
result = (
|
| 1767 |
await async_workos.user_management.authenticate_with_radar_sms_challenge(
|
| 1768 |
code="test_code",
|
| 1769 |
-
verification_id="test_verification_id",
|
| 1770 |
-
phone_number="test_phone_number",
|
| 1771 |
pending_authentication_token="test_pending_authentication_token",
|
| 1772 |
)
|
| 1773 |
)
|
|
|
|
| 858 |
httpx_mock.add_response(json=load_fixture("authenticate_response.json"))
|
| 859 |
result = workos.user_management.authenticate_with_radar_sms_challenge(
|
| 860 |
code="test_code",
|
|
|
|
|
|
|
| 861 |
pending_authentication_token="test_pending_authentication_token",
|
| 862 |
)
|
| 863 |
assert isinstance(result, AuthenticateResponse)
|
|
|
|
| 1764 |
result = (
|
| 1765 |
await async_workos.user_management.authenticate_with_radar_sms_challenge(
|
| 1766 |
code="test_code",
|
|
|
|
|
|
|
| 1767 |
pending_authentication_token="test_pending_authentication_token",
|
| 1768 |
)
|
| 1769 |
)
|
python/tests/test_vault.py|
@@ -3,9 +3,18 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
from workos.vault.models import (
|
| 10 |
CreateDataKeyResponse,
|
| 11 |
DecryptResponse,
|
|
@@ -13,17 +22,8 @@ from workos.vault.models import (
|
|
| 13 |
ObjectSummary,
|
| 14 |
ObjectWithoutValue,
|
| 15 |
VaultObject,
|
| 16 |
-
VersionListResponse,
|
| 17 |
VaultOrder,
|
| 18 |
-
)
|
| 19 |
-
from workos._pagination import AsyncPage, SyncPage
|
| 20 |
-
from workos._errors import (
|
| 21 |
-
|
| 22 |
-
BadRequestError,
|
| 23 |
-
NotFoundError,
|
| 24 |
-
RateLimitExceededError,
|
| 25 |
-
ServerError,
|
| 26 |
-
UnprocessableEntityError,
|
| 27 |
)
|
| 28 |
|
| 29 |
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 9 |
+
from workos._errors import (
|
| 10 |
+
AuthenticationError,
|
| 11 |
+
BadRequestError,
|
| 12 |
+
NotFoundError,
|
| 13 |
+
RateLimitExceededError,
|
| 14 |
+
ServerError,
|
| 15 |
+
UnprocessableEntityError,
|
| 16 |
+
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
from workos.vault.models import (
|
| 19 |
CreateDataKeyResponse,
|
| 20 |
DecryptResponse,
|
|
|
|
| 22 |
ObjectSummary,
|
| 23 |
ObjectWithoutValue,
|
| 24 |
VaultObject,
|
|
|
|
| 25 |
VaultOrder,
|
|
|
|
|
|
|
|
|
|
| 26 |
+
VersionListResponse,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
|
python/tests/test_vault_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.vault.models import (
|
| 8 |
Actor,
|
| 9 |
CreateDataKeyResponse,
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.vault.models import (
|
| 7 |
Actor,
|
| 8 |
CreateDataKeyResponse,
|
python/tests/test_webhooks.py|
@@ -3,12 +3,9 @@
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
| 6 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 7 |
-
from tests.generated_helpers import load_fixture
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
from workos
|
| 11 |
-
from workos._pagination import AsyncPage, SyncPage
|
| 12 |
from workos._errors import (
|
| 13 |
AuthenticationError,
|
| 14 |
BadRequestError,
|
|
@@ -17,6 +14,9 @@ from workos._errors import (
|
|
| 17 |
ServerError,
|
| 18 |
UnprocessableEntityError,
|
| 19 |
)
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
class TestWebhooks:
|
|
|
|
| 3 |
import json
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
from tests.generated_helpers import load_fixture
|
| 8 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
|
|
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
| 17 |
+
from workos._pagination import AsyncPage, SyncPage
|
| 18 |
+
from workos.common.models import PaginationOrder
|
| 19 |
+
from workos.webhooks.models import WebhookEndpoint
|
| 20 |
|
| 21 |
|
| 22 |
class TestWebhooks:
|
python/tests/test_webhooks_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.webhooks.models import WebhookEndpoint
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.webhooks.models import WebhookEndpoint
|
| 7 |
|
| 8 |
|
python/tests/test_widgets.py|
@@ -2,10 +2,9 @@
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
| 5 |
-
from workos import WorkOSClient, AsyncWorkOSClient
|
| 6 |
-
from tests.generated_helpers import load_fixture
|
| 7 |
|
|
|
|
| 8 |
-
from workos
|
| 9 |
from workos._errors import (
|
| 10 |
AuthenticationError,
|
| 11 |
BadRequestError,
|
|
@@ -14,6 +13,7 @@ from workos._errors import (
|
|
| 14 |
ServerError,
|
| 15 |
UnprocessableEntityError,
|
| 16 |
)
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
class TestWidgets:
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
import pytest
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
from tests.generated_helpers import load_fixture
|
| 7 |
+
from workos import AsyncWorkOSClient, WorkOSClient
|
| 8 |
from workos._errors import (
|
| 9 |
AuthenticationError,
|
| 10 |
BadRequestError,
|
|
|
|
| 13 |
ServerError,
|
| 14 |
UnprocessableEntityError,
|
| 15 |
)
|
| 16 |
+
from workos.widgets.models import WidgetSessionTokenResponse
|
| 17 |
|
| 18 |
|
| 19 |
class TestWidgets:
|
python/tests/test_widgets_models_round_trip.py|
@@ -3,7 +3,6 @@
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
| 6 |
-
|
| 7 |
from workos.widgets.models import WidgetSessionTokenResponse
|
|
|
|
| 3 |
"""Model round-trip tests: from_dict(to_dict()) preserves data."""
|
| 4 |
|
| 5 |
from tests.generated_helpers import load_fixture
|
|
|
|
| 6 |
from workos.widgets.models import WidgetSessionTokenResponse
|
All files in this language are hidden by the current filters.
code: 25 ยท tests: 5 ยท manifest: 1
ruby/.oagen-manifest.json|
@@ -279,6 +279,7 @@
|
|
| 279 |
"lib/workos/pipes/data_integrations_list_response_data.rb",
|
| 280 |
"lib/workos/pipes/data_integrations_list_response_data_connected_account.rb",
|
| 281 |
"lib/workos/pipes/data_integrations_upsert_api_key_request.rb",
|
|
|
|
| 282 |
"lib/workos/pipes/data_integrations_vend_credentials_request.rb",
|
| 283 |
"lib/workos/pipes/update_custom_provider_definition.rb",
|
| 284 |
"lib/workos/pipes/update_data_integration.rb",
|
|
@@ -312,6 +313,8 @@
|
|
| 312 |
"lib/workos/shared/agent_registration_expired_data.rb",
|
| 313 |
"lib/workos/shared/agent_registration_organization_switched.rb",
|
| 314 |
"lib/workos/shared/agent_registration_organization_switched_data.rb",
|
|
|
|
|
|
|
| 315 |
"lib/workos/shared/agent_registration_revoked.rb",
|
| 316 |
"lib/workos/shared/agent_registration_revoked_data.rb",
|
| 317 |
"lib/workos/shared/auth_method_mismatch_error.rb",
|
|
@@ -732,6 +735,8 @@
|
|
| 732 |
"rbi/workos/agent_registration_expired_data.rbi",
|
| 733 |
"rbi/workos/agent_registration_organization_switched.rbi",
|
| 734 |
"rbi/workos/agent_registration_organization_switched_data.rbi",
|
|
|
|
|
|
|
| 735 |
"rbi/workos/agent_registration_revoked.rbi",
|
| 736 |
"rbi/workos/agent_registration_revoked_data.rbi",
|
| 737 |
"rbi/workos/agents.rbi",
|
|
@@ -921,6 +926,7 @@
|
|
| 921 |
"rbi/workos/data_integrations_list_response_data.rbi",
|
| 922 |
"rbi/workos/data_integrations_list_response_data_connected_account.rbi",
|
| 923 |
"rbi/workos/data_integrations_upsert_api_key_request.rbi",
|
|
|
|
| 924 |
"rbi/workos/data_integrations_vend_credentials_request.rbi",
|
| 925 |
"rbi/workos/decrypt_request.rbi",
|
| 926 |
"rbi/workos/decrypt_response.rbi",
|
|
@@ -1595,6 +1601,10 @@
|
|
| 1595 |
"sdkMethod": "authorize_data_integration",
|
| 1596 |
"service": "pipes"
|
| 1597 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
"POST /data-integrations/{slug}/credentials": {
|
| 1599 |
"sdkMethod": "create_data_integration_credential",
|
| 1600 |
"service": "pipes"
|
|
|
|
| 279 |
"lib/workos/pipes/data_integrations_list_response_data.rb",
|
| 280 |
"lib/workos/pipes/data_integrations_list_response_data_connected_account.rb",
|
| 281 |
"lib/workos/pipes/data_integrations_upsert_api_key_request.rb",
|
| 282 |
+
"lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb",
|
| 283 |
"lib/workos/pipes/data_integrations_vend_credentials_request.rb",
|
| 284 |
"lib/workos/pipes/update_custom_provider_definition.rb",
|
| 285 |
"lib/workos/pipes/update_data_integration.rb",
|
|
|
|
| 313 |
"lib/workos/shared/agent_registration_expired_data.rb",
|
| 314 |
"lib/workos/shared/agent_registration_organization_switched.rb",
|
| 315 |
"lib/workos/shared/agent_registration_organization_switched_data.rb",
|
| 316 |
+
"lib/workos/shared/agent_registration_refreshed.rb",
|
| 317 |
+
"lib/workos/shared/agent_registration_refreshed_data.rb",
|
| 318 |
"lib/workos/shared/agent_registration_revoked.rb",
|
| 319 |
"lib/workos/shared/agent_registration_revoked_data.rb",
|
| 320 |
"lib/workos/shared/auth_method_mismatch_error.rb",
|
|
|
|
| 735 |
"rbi/workos/agent_registration_expired_data.rbi",
|
| 736 |
"rbi/workos/agent_registration_organization_switched.rbi",
|
| 737 |
"rbi/workos/agent_registration_organization_switched_data.rbi",
|
| 738 |
+
"rbi/workos/agent_registration_refreshed.rbi",
|
| 739 |
+
"rbi/workos/agent_registration_refreshed_data.rbi",
|
| 740 |
"rbi/workos/agent_registration_revoked.rbi",
|
| 741 |
"rbi/workos/agent_registration_revoked_data.rbi",
|
| 742 |
"rbi/workos/agents.rbi",
|
|
|
|
| 926 |
"rbi/workos/data_integrations_list_response_data.rbi",
|
| 927 |
"rbi/workos/data_integrations_list_response_data_connected_account.rbi",
|
| 928 |
"rbi/workos/data_integrations_upsert_api_key_request.rbi",
|
| 929 |
+
"rbi/workos/data_integrations_upsert_client_credentials_request.rbi",
|
| 930 |
"rbi/workos/data_integrations_vend_credentials_request.rbi",
|
| 931 |
"rbi/workos/decrypt_request.rbi",
|
| 932 |
"rbi/workos/decrypt_response.rbi",
|
|
|
|
| 1601 |
"sdkMethod": "authorize_data_integration",
|
| 1602 |
"service": "pipes"
|
| 1603 |
},
|
| 1604 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1605 |
+
"sdkMethod": "update_data_integration_client_credentials",
|
| 1606 |
+
"service": "pipes"
|
| 1607 |
+
},
|
| 1608 |
"POST /data-integrations/{slug}/credentials": {
|
| 1609 |
"sdkMethod": "create_data_integration_credential",
|
| 1610 |
"service": "pipes"
|
ruby/lib/workos/pipes.rb|
@@ -59,7 +59,7 @@ module WorkOS
|
|
| 59 |
# @param description [String, nil] An optional description of the Data Integration.
|
| 60 |
# @param enabled [Boolean, nil] Whether the Data Integration is enabled. Defaults to `false`.
|
| 61 |
# @param scopes [Array<String>, nil] The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 62 |
-
# @param auth_methods [Array<WorkOS::Types::CreateDataIntegrationAuthMethods>, nil] How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 63 |
# @param config [Hash{String => String}, nil] Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 64 |
# @param credentials [WorkOS::DataIntegrationCredentialsInput, nil] The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 65 |
# @param api_key [WorkOS::ApiKeyInstallation, nil] An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
@@ -242,6 +242,43 @@ module WorkOS
|
|
| 242 |
result
|
| 243 |
end
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
# Vend credentials for a connected account
|
| 246 |
# @param slug [String] The identifier of the integration.
|
| 247 |
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
|
|
|
| 59 |
# @param description [String, nil] An optional description of the Data Integration.
|
| 60 |
# @param enabled [Boolean, nil] Whether the Data Integration is enabled. Defaults to `false`.
|
| 61 |
# @param scopes [Array<String>, nil] The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 62 |
+
# @param auth_methods [Array<WorkOS::Types::CreateDataIntegrationAuthMethods>, nil] How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 63 |
# @param config [Hash{String => String}, nil] Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
| 64 |
# @param credentials [WorkOS::DataIntegrationCredentialsInput, nil] The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.
|
| 65 |
# @param api_key [WorkOS::ApiKeyInstallation, nil] An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.
|
|
|
|
| 242 |
result
|
| 243 |
end
|
| 244 |
|
| 245 |
+
# Upsert client credentials for a connected account
|
| 246 |
+
# @param slug [String] The identifier of the integration.
|
| 247 |
+
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 248 |
+
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 249 |
+
# @param client_id [String] The OAuth client ID to store for this integration.
|
| 250 |
+
# @param client_secret [String] The OAuth client secret to store for this integration.
|
| 251 |
+
# @param config [Hash{String => String}, nil] Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 252 |
+
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
| 253 |
+
# @return [WorkOS::ConnectedAccount]
|
| 254 |
+
def update_data_integration_client_credentials(
|
| 255 |
+
slug:,
|
| 256 |
+
user_id:,
|
| 257 |
+
client_id:,
|
| 258 |
+
client_secret:,
|
| 259 |
+
organization_id: nil,
|
| 260 |
+
config: nil,
|
| 261 |
+
request_options: {}
|
| 262 |
+
)
|
| 263 |
+
body = {
|
| 264 |
+
"user_id" => user_id,
|
| 265 |
+
"organization_id" => organization_id,
|
| 266 |
+
"client_id" => client_id,
|
| 267 |
+
"client_secret" => client_secret,
|
| 268 |
+
"config" => config
|
| 269 |
+
}.compact
|
| 270 |
+
response = @client.request(
|
| 271 |
+
method: :put,
|
| 272 |
+
path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/client-credentials",
|
| 273 |
+
auth: true,
|
| 274 |
+
body: body,
|
| 275 |
+
request_options: request_options
|
| 276 |
+
)
|
| 277 |
+
result = WorkOS::ConnectedAccount.new(response.body)
|
| 278 |
+
result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
|
| 279 |
+
result
|
| 280 |
+
end
|
| 281 |
+
|
| 282 |
# Vend credentials for a connected account
|
| 283 |
# @param slug [String] The identifier of the integration.
|
| 284 |
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
ruby/lib/workos/pipes/connected_account.rb|
@@ -12,6 +12,9 @@ module WorkOS
|
|
| 12 |
scopes: :scopes,
|
| 13 |
auth_method: :auth_method,
|
| 14 |
api_key_last_4: :api_key_last_4,
|
|
|
|
|
|
|
|
|
|
| 15 |
state: :state,
|
| 16 |
created_at: :created_at,
|
| 17 |
updated_at: :updated_at
|
|
@@ -25,6 +28,9 @@ module WorkOS
|
|
| 25 |
:scopes,
|
| 26 |
:auth_method,
|
| 27 |
:api_key_last_4,
|
|
|
|
|
|
|
|
|
|
| 28 |
:state,
|
| 29 |
:created_at,
|
| 30 |
:updated_at
|
|
@@ -38,6 +44,9 @@ module WorkOS
|
|
| 38 |
@scopes = hash[:scopes] || []
|
| 39 |
@auth_method = hash[:auth_method]
|
| 40 |
@api_key_last_4 = hash[:api_key_last_4]
|
|
|
|
|
|
|
|
|
|
| 41 |
@state = hash[:state]
|
| 42 |
@created_at = hash[:created_at]
|
| 43 |
@updated_at = hash[:updated_at]
|
|
|
|
| 12 |
scopes: :scopes,
|
| 13 |
auth_method: :auth_method,
|
| 14 |
api_key_last_4: :api_key_last_4,
|
| 15 |
+
client_id: :client_id,
|
| 16 |
+
client_secret_last_4: :client_secret_last_4,
|
| 17 |
+
config: :config,
|
| 18 |
state: :state,
|
| 19 |
created_at: :created_at,
|
| 20 |
updated_at: :updated_at
|
|
|
|
| 28 |
:scopes,
|
| 29 |
:auth_method,
|
| 30 |
:api_key_last_4,
|
| 31 |
+
:client_id,
|
| 32 |
+
:client_secret_last_4,
|
| 33 |
+
:config,
|
| 34 |
:state,
|
| 35 |
:created_at,
|
| 36 |
:updated_at
|
|
|
|
| 44 |
@scopes = hash[:scopes] || []
|
| 45 |
@auth_method = hash[:auth_method]
|
| 46 |
@api_key_last_4 = hash[:api_key_last_4]
|
| 47 |
+
@client_id = hash[:client_id]
|
| 48 |
+
@client_secret_last_4 = hash[:client_secret_last_4]
|
| 49 |
+
@config = hash[:config] || {}
|
| 50 |
@state = hash[:state]
|
| 51 |
@created_at = hash[:created_at]
|
| 52 |
@updated_at = hash[:updated_at]
|
ruby/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb|
@@ -12,6 +12,9 @@ module WorkOS
|
|
| 12 |
scopes: :scopes,
|
| 13 |
auth_method: :auth_method,
|
| 14 |
api_key_last_4: :api_key_last_4,
|
|
|
|
|
|
|
|
|
|
| 15 |
state: :state,
|
| 16 |
created_at: :created_at,
|
| 17 |
updated_at: :updated_at,
|
|
@@ -29,6 +32,9 @@ module WorkOS
|
|
| 29 |
:scopes,
|
| 30 |
:auth_method,
|
| 31 |
:api_key_last_4,
|
|
|
|
|
|
|
|
|
|
| 32 |
:state,
|
| 33 |
:created_at,
|
| 34 |
:updated_at
|
|
@@ -49,6 +55,9 @@ module WorkOS
|
|
| 49 |
@scopes = hash[:scopes] || []
|
| 50 |
@auth_method = hash[:auth_method]
|
| 51 |
@api_key_last_4 = hash[:api_key_last_4]
|
|
|
|
|
|
|
|
|
|
| 52 |
@state = hash[:state]
|
| 53 |
@created_at = hash[:created_at]
|
| 54 |
@updated_at = hash[:updated_at]
|
|
|
|
| 12 |
scopes: :scopes,
|
| 13 |
auth_method: :auth_method,
|
| 14 |
api_key_last_4: :api_key_last_4,
|
| 15 |
+
client_id: :client_id,
|
| 16 |
+
client_secret_last_4: :client_secret_last_4,
|
| 17 |
+
config: :config,
|
| 18 |
state: :state,
|
| 19 |
created_at: :created_at,
|
| 20 |
updated_at: :updated_at,
|
|
|
|
| 32 |
:scopes,
|
| 33 |
:auth_method,
|
| 34 |
:api_key_last_4,
|
| 35 |
+
:client_id,
|
| 36 |
+
:client_secret_last_4,
|
| 37 |
+
:config,
|
| 38 |
:state,
|
| 39 |
:created_at,
|
| 40 |
:updated_at
|
|
|
|
| 55 |
@scopes = hash[:scopes] || []
|
| 56 |
@auth_method = hash[:auth_method]
|
| 57 |
@api_key_last_4 = hash[:api_key_last_4]
|
| 58 |
+
@client_id = hash[:client_id]
|
| 59 |
+
@client_secret_last_4 = hash[:client_secret_last_4]
|
| 60 |
+
@config = hash[:config] || {}
|
| 61 |
@state = hash[:state]
|
| 62 |
@created_at = hash[:created_at]
|
| 63 |
@updated_at = hash[:updated_at]
|
ruby/lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# frozen_string_literal: true
|
| 2 |
+
|
| 3 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 4 |
+
|
| 5 |
+
module WorkOS
|
| 6 |
+
class DataIntegrationsUpsertClientCredentialsRequest < WorkOS::Types::BaseModel
|
| 7 |
+
HASH_ATTRS = {
|
| 8 |
+
user_id: :user_id,
|
| 9 |
+
organization_id: :organization_id,
|
| 10 |
+
client_id: :client_id,
|
| 11 |
+
client_secret: :client_secret,
|
| 12 |
+
config: :config
|
| 13 |
+
}.freeze
|
| 14 |
+
|
| 15 |
+
attr_accessor \
|
| 16 |
+
:user_id,
|
| 17 |
+
:organization_id,
|
| 18 |
+
:client_id,
|
| 19 |
+
:client_secret,
|
| 20 |
+
:config
|
| 21 |
+
|
| 22 |
+
def initialize(json)
|
| 23 |
+
hash = self.class.normalize(json)
|
| 24 |
+
@user_id = hash[:user_id]
|
| 25 |
+
@organization_id = hash[:organization_id]
|
| 26 |
+
@client_id = hash[:client_id]
|
| 27 |
+
@client_secret = hash[:client_secret]
|
| 28 |
+
@config = hash[:config] || {}
|
| 29 |
+
end
|
| 30 |
+
end
|
| 31 |
+
end
|
ruby/lib/workos/types/authenticate_response_authentication_method.rb|
@@ -16,6 +16,8 @@ module WorkOS
|
|
| 16 |
GIT_HUB_OAUTH = "GitHubOAuth"
|
| 17 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 18 |
GOOGLE_OAUTH = "GoogleOAuth"
|
|
|
|
|
|
|
| 19 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 20 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 21 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
@@ -27,7 +29,7 @@ module WorkOS
|
|
| 27 |
MAGIC_AUTH = "MagicAuth"
|
| 28 |
IMPERSONATION = "Impersonation"
|
| 29 |
MIGRATED_SESSION = "MigratedSession"
|
| 30 |
-
ALL = [SSO, PASSWORD, PASSKEY, APPLE_OAUTH, BITBUCKET_OAUTH, CROSS_APP_AUTH, DISCORD_OAUTH, EXTERNAL_AUTH, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH, MAGIC_AUTH, IMPERSONATION, MIGRATED_SESSION].freeze
|
| 31 |
end
|
| 32 |
end
|
| 33 |
end
|
|
|
|
| 16 |
GIT_HUB_OAUTH = "GitHubOAuth"
|
| 17 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 18 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 19 |
+
GROK_OAUTH = "GrokOAuth"
|
| 20 |
+
XO_AUTH = "XOAuth"
|
| 21 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 22 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 23 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
|
|
| 29 |
MAGIC_AUTH = "MagicAuth"
|
| 30 |
IMPERSONATION = "Impersonation"
|
| 31 |
MIGRATED_SESSION = "MigratedSession"
|
| 32 |
+
ALL = [SSO, PASSWORD, PASSKEY, APPLE_OAUTH, BITBUCKET_OAUTH, CROSS_APP_AUTH, DISCORD_OAUTH, EXTERNAL_AUTH, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GROK_OAUTH, XO_AUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH, MAGIC_AUTH, IMPERSONATION, MIGRATED_SESSION].freeze
|
| 33 |
end
|
| 34 |
end
|
| 35 |
end
|
ruby/lib/workos/types/connection_activated_data_connection_type.rb|
@@ -27,6 +27,8 @@ module WorkOS
|
|
| 27 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 28 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 29 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 30 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 31 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 32 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -55,7 +57,7 @@ module WorkOS
|
|
| 55 |
VERCEL_OAUTH = "VercelOAuth"
|
| 56 |
V_MWARE_SAML = "VMwareSAML"
|
| 57 |
XERO_OAUTH = "XeroOAuth"
|
| 58 |
-
ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 59 |
end
|
| 60 |
end
|
| 61 |
end
|
|
|
|
| 27 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 28 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 29 |
GOOGLE_SAML = "GoogleSAML"
|
| 30 |
+
GROK_OAUTH = "GrokOAuth"
|
| 31 |
+
XO_AUTH = "XOAuth"
|
| 32 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 33 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 34 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 57 |
VERCEL_OAUTH = "VercelOAuth"
|
| 58 |
V_MWARE_SAML = "VMwareSAML"
|
| 59 |
XERO_OAUTH = "XeroOAuth"
|
| 60 |
+
ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, GROK_OAUTH, XO_AUTH, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 61 |
end
|
| 62 |
end
|
| 63 |
end
|
ruby/lib/workos/types/connection_type.rb|
@@ -28,6 +28,8 @@ module WorkOS
|
|
| 28 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 29 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 30 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 31 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 32 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 33 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -56,7 +58,7 @@ module WorkOS
|
|
| 56 |
VERCEL_OAUTH = "VercelOAuth"
|
| 57 |
V_MWARE_SAML = "VMwareSAML"
|
| 58 |
XERO_OAUTH = "XeroOAuth"
|
| 59 |
-
ALL = [PENDING, ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 60 |
end
|
| 61 |
end
|
| 62 |
end
|
|
|
|
| 28 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 29 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 30 |
GOOGLE_SAML = "GoogleSAML"
|
| 31 |
+
GROK_OAUTH = "GrokOAuth"
|
| 32 |
+
XO_AUTH = "XOAuth"
|
| 33 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 34 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 35 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 58 |
VERCEL_OAUTH = "VercelOAuth"
|
| 59 |
V_MWARE_SAML = "VMwareSAML"
|
| 60 |
XERO_OAUTH = "XeroOAuth"
|
| 61 |
+
ALL = [PENDING, ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, GROK_OAUTH, XO_AUTH, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 62 |
end
|
| 63 |
end
|
| 64 |
end
|
ruby/lib/workos/types/connections_connection_type.rb|
@@ -26,6 +26,8 @@ module WorkOS
|
|
| 26 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 27 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 28 |
GOOGLE_SAML = "GoogleSAML"
|
|
|
|
|
|
|
| 29 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 30 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 31 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
@@ -53,7 +55,7 @@ module WorkOS
|
|
| 53 |
VERCEL_OAUTH = "VercelOAuth"
|
| 54 |
V_MWARE_SAML = "VMwareSAML"
|
| 55 |
XERO_OAUTH = "XeroOAuth"
|
| 56 |
-
ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLOUDFLARE_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 57 |
end
|
| 58 |
end
|
| 59 |
end
|
|
|
|
| 26 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 27 |
GOOGLE_OIDC = "GoogleOIDC"
|
| 28 |
GOOGLE_SAML = "GoogleSAML"
|
| 29 |
+
GROK_OAUTH = "GrokOAuth"
|
| 30 |
+
XO_AUTH = "XOAuth"
|
| 31 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 32 |
JUMP_CLOUD_SAML = "JumpCloudSAML"
|
| 33 |
KEYCLOAK_SAML = "KeycloakSAML"
|
|
|
|
| 55 |
VERCEL_OAUTH = "VercelOAuth"
|
| 56 |
V_MWARE_SAML = "VMwareSAML"
|
| 57 |
XERO_OAUTH = "XeroOAuth"
|
| 58 |
+
ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLOUDFLARE_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, GROK_OAUTH, XO_AUTH, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze
|
| 59 |
end
|
| 60 |
end
|
| 61 |
end
|
ruby/lib/workos/types/create_data_integration_auth_methods.rb|
@@ -4,10 +4,6 @@
|
|
| 4 |
|
| 5 |
module WorkOS
|
| 6 |
module Types
|
| 7 |
-
|
| 8 |
-
OAUTH = "oauth"
|
| 9 |
-
API_KEY = "api_key"
|
| 10 |
-
ALL = [OAUTH, API_KEY].freeze
|
| 11 |
-
end
|
| 12 |
end
|
| 13 |
end
|
|
|
|
| 4 |
|
| 5 |
module WorkOS
|
| 6 |
module Types
|
| 7 |
+
CreateDataIntegrationAuthMethods = ConnectedAccountAuthMethod
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
end
|
| 9 |
end
|
ruby/lib/workos/types/create_webhook_endpoint_events.rb|
@@ -10,6 +10,7 @@ module WorkOS
|
|
| 10 |
AGENT_REGISTRATION_CLAIM_COMPLETED = "agent.registration.claim.completed"
|
| 11 |
AGENT_REGISTRATION_CREDENTIAL_ISSUED = "agent.registration.credential.issued"
|
| 12 |
AGENT_REGISTRATION_DELETED = "agent.registration.deleted"
|
|
|
|
| 13 |
AGENT_REGISTRATION_EXPIRED = "agent.registration.expired"
|
| 14 |
AGENT_REGISTRATION_ORGANIZATION_SWITCHED = "agent.registration.organization.switched"
|
| 15 |
AGENT_REGISTRATION_REVOKED = "agent.registration.revoked"
|
|
@@ -97,7 +98,7 @@ module WorkOS
|
|
| 97 |
WAITLIST_USER_APPROVED = "waitlist_user.approved"
|
| 98 |
WAITLIST_USER_CREATED = "waitlist_user.created"
|
| 99 |
WAITLIST_USER_DENIED = "waitlist_user.denied"
|
| 100 |
-
ALL = [AGENT_REGISTRATION_CREATED, AGENT_REGISTRATION_CLAIM_ATTEMPT_CREATED, AGENT_REGISTRATION_CLAIM_COMPLETED, AGENT_REGISTRATION_CREDENTIAL_ISSUED, AGENT_REGISTRATION_DELETED, AGENT_REGISTRATION_EXPIRED, AGENT_REGISTRATION_ORGANIZATION_SWITCHED, AGENT_REGISTRATION_REVOKED, AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED, AUTHENTICATION_MAGIC_AUTH_FAILED, AUTHENTICATION_MAGIC_AUTH_SUCCEEDED, AUTHENTICATION_MFA_SUCCEEDED, AUTHENTICATION_OAUTH_FAILED, AUTHENTICATION_OAUTH_SUCCEEDED, AUTHENTICATION_PASSWORD_FAILED, AUTHENTICATION_PASSWORD_SUCCEEDED, AUTHENTICATION_PASSKEY_FAILED, AUTHENTICATION_PASSKEY_SUCCEEDED, AUTHENTICATION_SSO_FAILED, AUTHENTICATION_SSO_STARTED, AUTHENTICATION_SSO_SUCCEEDED, AUTHENTICATION_SSO_TIMED_OUT, RADAR_CHALLENGE_CREATED, AUTHENTICATION_RADAR_RISK_DETECTED, AUTHENTICATION_REAUTHENTICATION_SUCCEEDED, API_KEY_CREATED, API_KEY_REVOKED, API_KEY_UPDATED, CONNECTION_ACTIVATED, CONNECTION_DEACTIVATED, CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED, CONNECTION_SAML_CERTIFICATE_RENEWED, CONNECTION_DELETED, DSYNC_ACTIVATED, DSYNC_DELETED, DSYNC_GROUP_CREATED, DSYNC_GROUP_DELETED, DSYNC_GROUP_UPDATED, DSYNC_GROUP_USER_ADDED, DSYNC_GROUP_USER_REMOVED, DSYNC_USER_CREATED, DSYNC_USER_DELETED, DSYNC_USER_UPDATED, EMAIL_VERIFICATION_CREATED, GROUP_CREATED, GROUP_DELETED, GROUP_MEMBER_ADDED, GROUP_MEMBER_REMOVED, GROUP_UPDATED, FLAG_CREATED, FLAG_DELETED, FLAG_UPDATED, FLAG_RULE_UPDATED, INVITATION_ACCEPTED, INVITATION_CREATED, INVITATION_RESENT, INVITATION_REVOKED, MAGIC_AUTH_CREATED, ORGANIZATION_CREATED, ORGANIZATION_DELETED, ORGANIZATION_UPDATED, ORGANIZATION_DOMAIN_CREATED, ORGANIZATION_DOMAIN_DELETED, ORGANIZATION_DOMAIN_UPDATED, ORGANIZATION_DOMAIN_VERIFIED, ORGANIZATION_DOMAIN_VERIFICATION_FAILED, PASSWORD_RESET_CREATED, PASSWORD_RESET_SUCCEEDED, USER_CREATED, USER_UPDATED, USER_DELETED, ORGANIZATION_MEMBERSHIP_CREATED, ORGANIZATION_MEMBERSHIP_DELETED, ORGANIZATION_MEMBERSHIP_UPDATED, ROLE_CREATED, ROLE_DELETED, ROLE_UPDATED, ORGANIZATION_ROLE_CREATED, ORGANIZATION_ROLE_DELETED, ORGANIZATION_ROLE_UPDATED, PERMISSION_CREATED, PERMISSION_DELETED, PERMISSION_UPDATED, PIPES_CONNECTED_ACCOUNT_CONNECTED, PIPES_CONNECTED_ACCOUNT_CONNECTION_FAILED, PIPES_CONNECTED_ACCOUNT_DISCONNECTED, PIPES_CONNECTED_ACCOUNT_REAUTHORIZATION_NEEDED, SESSION_CREATED, SESSION_REVOKED, WAITLIST_USER_APPROVED, WAITLIST_USER_CREATED, WAITLIST_USER_DENIED].freeze
|
| 101 |
end
|
| 102 |
end
|
| 103 |
end
|
|
|
|
| 10 |
AGENT_REGISTRATION_CLAIM_COMPLETED = "agent.registration.claim.completed"
|
| 11 |
AGENT_REGISTRATION_CREDENTIAL_ISSUED = "agent.registration.credential.issued"
|
| 12 |
AGENT_REGISTRATION_DELETED = "agent.registration.deleted"
|
| 13 |
+
AGENT_REGISTRATION_REFRESHED = "agent.registration.refreshed"
|
| 14 |
AGENT_REGISTRATION_EXPIRED = "agent.registration.expired"
|
| 15 |
AGENT_REGISTRATION_ORGANIZATION_SWITCHED = "agent.registration.organization.switched"
|
| 16 |
AGENT_REGISTRATION_REVOKED = "agent.registration.revoked"
|
|
|
|
| 98 |
WAITLIST_USER_APPROVED = "waitlist_user.approved"
|
| 99 |
WAITLIST_USER_CREATED = "waitlist_user.created"
|
| 100 |
WAITLIST_USER_DENIED = "waitlist_user.denied"
|
| 101 |
+
ALL = [AGENT_REGISTRATION_CREATED, AGENT_REGISTRATION_CLAIM_ATTEMPT_CREATED, AGENT_REGISTRATION_CLAIM_COMPLETED, AGENT_REGISTRATION_CREDENTIAL_ISSUED, AGENT_REGISTRATION_DELETED, AGENT_REGISTRATION_REFRESHED, AGENT_REGISTRATION_EXPIRED, AGENT_REGISTRATION_ORGANIZATION_SWITCHED, AGENT_REGISTRATION_REVOKED, AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED, AUTHENTICATION_MAGIC_AUTH_FAILED, AUTHENTICATION_MAGIC_AUTH_SUCCEEDED, AUTHENTICATION_MFA_SUCCEEDED, AUTHENTICATION_OAUTH_FAILED, AUTHENTICATION_OAUTH_SUCCEEDED, AUTHENTICATION_PASSWORD_FAILED, AUTHENTICATION_PASSWORD_SUCCEEDED, AUTHENTICATION_PASSKEY_FAILED, AUTHENTICATION_PASSKEY_SUCCEEDED, AUTHENTICATION_SSO_FAILED, AUTHENTICATION_SSO_STARTED, AUTHENTICATION_SSO_SUCCEEDED, AUTHENTICATION_SSO_TIMED_OUT, RADAR_CHALLENGE_CREATED, AUTHENTICATION_RADAR_RISK_DETECTED, AUTHENTICATION_REAUTHENTICATION_SUCCEEDED, API_KEY_CREATED, API_KEY_REVOKED, API_KEY_UPDATED, CONNECTION_ACTIVATED, CONNECTION_DEACTIVATED, CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED, CONNECTION_SAML_CERTIFICATE_RENEWED, CONNECTION_DELETED, DSYNC_ACTIVATED, DSYNC_DELETED, DSYNC_GROUP_CREATED, DSYNC_GROUP_DELETED, DSYNC_GROUP_UPDATED, DSYNC_GROUP_USER_ADDED, DSYNC_GROUP_USER_REMOVED, DSYNC_USER_CREATED, DSYNC_USER_DELETED, DSYNC_USER_UPDATED, EMAIL_VERIFICATION_CREATED, GROUP_CREATED, GROUP_DELETED, GROUP_MEMBER_ADDED, GROUP_MEMBER_REMOVED, GROUP_UPDATED, FLAG_CREATED, FLAG_DELETED, FLAG_UPDATED, FLAG_RULE_UPDATED, INVITATION_ACCEPTED, INVITATION_CREATED, INVITATION_RESENT, INVITATION_REVOKED, MAGIC_AUTH_CREATED, ORGANIZATION_CREATED, ORGANIZATION_DELETED, ORGANIZATION_UPDATED, ORGANIZATION_DOMAIN_CREATED, ORGANIZATION_DOMAIN_DELETED, ORGANIZATION_DOMAIN_UPDATED, ORGANIZATION_DOMAIN_VERIFIED, ORGANIZATION_DOMAIN_VERIFICATION_FAILED, PASSWORD_RESET_CREATED, PASSWORD_RESET_SUCCEEDED, USER_CREATED, USER_UPDATED, USER_DELETED, ORGANIZATION_MEMBERSHIP_CREATED, ORGANIZATION_MEMBERSHIP_DELETED, ORGANIZATION_MEMBERSHIP_UPDATED, ROLE_CREATED, ROLE_DELETED, ROLE_UPDATED, ORGANIZATION_ROLE_CREATED, ORGANIZATION_ROLE_DELETED, ORGANIZATION_ROLE_UPDATED, PERMISSION_CREATED, PERMISSION_DELETED, PERMISSION_UPDATED, PIPES_CONNECTED_ACCOUNT_CONNECTED, PIPES_CONNECTED_ACCOUNT_CONNECTION_FAILED, PIPES_CONNECTED_ACCOUNT_DISCONNECTED, PIPES_CONNECTED_ACCOUNT_REAUTHORIZATION_NEEDED, SESSION_CREATED, SESSION_REVOKED, WAITLIST_USER_APPROVED, WAITLIST_USER_CREATED, WAITLIST_USER_DENIED].freeze
|
| 102 |
end
|
| 103 |
end
|
| 104 |
end
|
ruby/lib/workos/types/user_identities_get_item_provider.rb|
@@ -11,6 +11,8 @@ module WorkOS
|
|
| 11 |
GITHUB_OAUTH = "GithubOAuth"
|
| 12 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 13 |
GOOGLE_OAUTH = "GoogleOAuth"
|
|
|
|
|
|
|
| 14 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 15 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 16 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
@@ -19,7 +21,7 @@ module WorkOS
|
|
| 19 |
VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth"
|
| 20 |
VERCEL_OAUTH = "VercelOAuth"
|
| 21 |
XERO_OAUTH = "XeroOAuth"
|
| 22 |
-
ALL = [APPLE_OAUTH, BITBUCKET_OAUTH, DISCORD_OAUTH, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH].freeze
|
| 23 |
end
|
| 24 |
end
|
| 25 |
end
|
|
|
|
| 11 |
GITHUB_OAUTH = "GithubOAuth"
|
| 12 |
GIT_LAB_OAUTH = "GitLabOAuth"
|
| 13 |
GOOGLE_OAUTH = "GoogleOAuth"
|
| 14 |
+
GROK_OAUTH = "GrokOAuth"
|
| 15 |
+
XO_AUTH = "XOAuth"
|
| 16 |
INTUIT_OAUTH = "IntuitOAuth"
|
| 17 |
LINKED_IN_OAUTH = "LinkedInOAuth"
|
| 18 |
MICROSOFT_OAUTH = "MicrosoftOAuth"
|
|
|
|
| 21 |
VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth"
|
| 22 |
VERCEL_OAUTH = "VercelOAuth"
|
| 23 |
XERO_OAUTH = "XeroOAuth"
|
| 24 |
+
ALL = [APPLE_OAUTH, BITBUCKET_OAUTH, DISCORD_OAUTH, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GROK_OAUTH, XO_AUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH].freeze
|
| 25 |
end
|
| 26 |
end
|
| 27 |
end
|
ruby/lib/workos/user_management.rb|
@@ -63,8 +63,8 @@ module WorkOS
|
|
| 63 |
# @param pending_authentication_token [String, nil] The pending authentication token from a previous authentication attempt.
|
| 64 |
# @param authentication_challenge_id [String, nil] The ID of the MFA authentication challenge.
|
| 65 |
# @param radar_challenge_id [String, nil] The ID of the Radar email challenge being verified.
|
| 66 |
-
# @param verification_id [String, nil] The ID of the Radar SMS verification being confirmed.
|
| 67 |
-
# @param phone_number [String, nil] The phone number the Radar SMS challenge was sent to.
|
| 68 |
# @param device_code [String, nil] The device verification code.
|
| 69 |
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
| 70 |
# @return [WorkOS::AuthenticateResponse]
|
|
@@ -476,8 +476,8 @@ module WorkOS
|
|
| 476 |
|
| 477 |
# Authenticate with radar sms challenge.
|
| 478 |
# @param code [String]
|
| 479 |
-
# @param verification_id [String]
|
| 480 |
-
# @param phone_number [String]
|
| 481 |
# @param pending_authentication_token [String]
|
| 482 |
# @param ip_address [String, nil]
|
| 483 |
# @param device_id [String, nil]
|
|
@@ -486,9 +486,9 @@ module WorkOS
|
|
| 486 |
# @return [WorkOS::AuthenticateResponse]
|
| 487 |
def authenticate_with_radar_sms_challenge(
|
| 488 |
code:,
|
| 489 |
-
verification_id:,
|
| 490 |
-
phone_number:,
|
| 491 |
pending_authentication_token:,
|
|
|
|
|
|
|
| 492 |
ip_address: nil,
|
| 493 |
device_id: nil,
|
| 494 |
user_agent: nil,
|
|
|
|
| 63 |
# @param pending_authentication_token [String, nil] The pending authentication token from a previous authentication attempt.
|
| 64 |
# @param authentication_challenge_id [String, nil] The ID of the MFA authentication challenge.
|
| 65 |
# @param radar_challenge_id [String, nil] The ID of the Radar email challenge being verified.
|
| 66 |
+
# @param verification_id [String, nil] The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
| 67 |
+
# @param phone_number [String, nil] The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
| 68 |
# @param device_code [String, nil] The device verification code.
|
| 69 |
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
|
| 70 |
# @return [WorkOS::AuthenticateResponse]
|
|
|
|
| 476 |
|
| 477 |
# Authenticate with radar sms challenge.
|
| 478 |
# @param code [String]
|
| 479 |
+
# @param verification_id [String, nil]
|
| 480 |
+
# @param phone_number [String, nil]
|
| 481 |
# @param pending_authentication_token [String]
|
| 482 |
# @param ip_address [String, nil]
|
| 483 |
# @param device_id [String, nil]
|
|
|
|
| 486 |
# @return [WorkOS::AuthenticateResponse]
|
| 487 |
def authenticate_with_radar_sms_challenge(
|
| 488 |
code:,
|
|
|
|
|
|
|
| 489 |
pending_authentication_token:,
|
| 490 |
+
verification_id: nil,
|
| 491 |
+
phone_number: nil,
|
| 492 |
ip_address: nil,
|
| 493 |
device_id: nil,
|
| 494 |
user_agent: nil,
|
ruby/rbi/workos/agent_registration_refreshed.rbi|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# frozen_string_literal: true
|
| 2 |
+
|
| 3 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 4 |
+
|
| 5 |
+
# typed: strong
|
| 6 |
+
|
| 7 |
+
module WorkOS
|
| 8 |
+
class AgentRegistrationRefreshed
|
| 9 |
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
| 10 |
+
def initialize(json); end
|
| 11 |
+
|
| 12 |
+
sig { returns(String) }
|
| 13 |
+
def object; end
|
| 14 |
+
|
| 15 |
+
sig { params(value: String).returns(String) }
|
| 16 |
+
def object=(value); end
|
| 17 |
+
|
| 18 |
+
sig { returns(String) }
|
| 19 |
+
def id; end
|
| 20 |
+
|
| 21 |
+
sig { params(value: String).returns(String) }
|
| 22 |
+
def id=(value); end
|
| 23 |
+
|
| 24 |
+
sig { returns(String) }
|
| 25 |
+
def event; end
|
| 26 |
+
|
| 27 |
+
sig { params(value: String).returns(String) }
|
| 28 |
+
def event=(value); end
|
| 29 |
+
|
| 30 |
+
sig { returns(WorkOS::AgentRegistrationRefreshedData) }
|
| 31 |
+
def data; end
|
| 32 |
+
|
| 33 |
+
sig { params(value: WorkOS::AgentRegistrationRefreshedData).returns(WorkOS::AgentRegistrationRefreshedData) }
|
| 34 |
+
def data=(value); end
|
| 35 |
+
|
| 36 |
+
sig { returns(String) }
|
| 37 |
+
def created_at; end
|
| 38 |
+
|
| 39 |
+
sig { params(value: String).returns(String) }
|
| 40 |
+
def created_at=(value); end
|
| 41 |
+
|
| 42 |
+
sig { returns(T.nilable(WorkOS::EventContext)) }
|
| 43 |
+
def context; end
|
| 44 |
+
|
| 45 |
+
sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) }
|
| 46 |
+
def context=(value); end
|
| 47 |
+
|
| 48 |
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
| 49 |
+
def to_h; end
|
| 50 |
+
|
| 51 |
+
sig { params(args: T.untyped).returns(String) }
|
| 52 |
+
def to_json(*args); end
|
| 53 |
+
end
|
| 54 |
+
end
|
ruby/rbi/workos/agent_registration_refreshed_data.rbi|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# frozen_string_literal: true
|
| 2 |
+
|
| 3 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 4 |
+
|
| 5 |
+
# typed: strong
|
| 6 |
+
|
| 7 |
+
module WorkOS
|
| 8 |
+
class AgentRegistrationRefreshedData
|
| 9 |
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
| 10 |
+
def initialize(json); end
|
| 11 |
+
|
| 12 |
+
sig { returns(String) }
|
| 13 |
+
def agent_registration_id; end
|
| 14 |
+
|
| 15 |
+
sig { params(value: String).returns(String) }
|
| 16 |
+
def agent_registration_id=(value); end
|
| 17 |
+
|
| 18 |
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
| 19 |
+
def to_h; end
|
| 20 |
+
|
| 21 |
+
sig { params(args: T.untyped).returns(String) }
|
| 22 |
+
def to_json(*args); end
|
| 23 |
+
end
|
| 24 |
+
end
|
ruby/rbi/workos/connected_account.rbi|
@@ -51,6 +51,24 @@ module WorkOS
|
|
| 51 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 52 |
def api_key_last_4=(value); end
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
sig { returns(String) }
|
| 55 |
def state; end
|
| 56 |
|
|
|
|
| 51 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 52 |
def api_key_last_4=(value); end
|
| 53 |
|
| 54 |
+
sig { returns(T.nilable(String)) }
|
| 55 |
+
def client_id; end
|
| 56 |
+
|
| 57 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 58 |
+
def client_id=(value); end
|
| 59 |
+
|
| 60 |
+
sig { returns(T.nilable(String)) }
|
| 61 |
+
def client_secret_last_4; end
|
| 62 |
+
|
| 63 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 64 |
+
def client_secret_last_4=(value); end
|
| 65 |
+
|
| 66 |
+
sig { returns(T.nilable(T::Hash[String, String])) }
|
| 67 |
+
def config; end
|
| 68 |
+
|
| 69 |
+
sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) }
|
| 70 |
+
def config=(value); end
|
| 71 |
+
|
| 72 |
sig { returns(String) }
|
| 73 |
def state; end
|
| 74 |
|
ruby/rbi/workos/custom_provider_definition.rbi|
@@ -15,16 +15,16 @@ module WorkOS
|
|
| 15 |
sig { params(value: String).returns(String) }
|
| 16 |
def name=(value); end
|
| 17 |
|
| 18 |
-
sig { returns(String) }
|
| 19 |
def authorization_url; end
|
| 20 |
|
| 21 |
-
sig { params(value: String).returns(String) }
|
| 22 |
def authorization_url=(value); end
|
| 23 |
|
| 24 |
-
sig { returns(String) }
|
| 25 |
def token_url; end
|
| 26 |
|
| 27 |
-
sig { params(value: String).returns(String) }
|
| 28 |
def token_url=(value); end
|
| 29 |
|
| 30 |
sig { returns(T.nilable(String)) }
|
|
|
|
| 15 |
sig { params(value: String).returns(String) }
|
| 16 |
def name=(value); end
|
| 17 |
|
| 18 |
+
sig { returns(T.nilable(String)) }
|
| 19 |
def authorization_url; end
|
| 20 |
|
| 21 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 22 |
def authorization_url=(value); end
|
| 23 |
|
| 24 |
+
sig { returns(T.nilable(String)) }
|
| 25 |
def token_url; end
|
| 26 |
|
| 27 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 28 |
def token_url=(value); end
|
| 29 |
|
| 30 |
sig { returns(T.nilable(String)) }
|
ruby/rbi/workos/data_integration.rbi|
@@ -69,10 +69,10 @@ module WorkOS
|
|
| 69 |
sig { params(value: T::Array[String]).returns(T::Array[String]) }
|
| 70 |
def auth_methods=(value); end
|
| 71 |
|
| 72 |
-
sig { returns(WorkOS::DataIntegrationCredential) }
|
| 73 |
def credentials; end
|
| 74 |
|
| 75 |
-
sig { params(value: WorkOS::DataIntegrationCredential).returns(WorkOS::DataIntegrationCredential) }
|
| 76 |
def credentials=(value); end
|
| 77 |
|
| 78 |
sig { returns(T.nilable(WorkOS::DataIntegrationInstallation)) }
|
|
|
|
| 69 |
sig { params(value: T::Array[String]).returns(T::Array[String]) }
|
| 70 |
def auth_methods=(value); end
|
| 71 |
|
| 72 |
+
sig { returns(T.nilable(WorkOS::DataIntegrationCredential)) }
|
| 73 |
def credentials; end
|
| 74 |
|
| 75 |
+
sig { params(value: T.nilable(WorkOS::DataIntegrationCredential)).returns(T.nilable(WorkOS::DataIntegrationCredential)) }
|
| 76 |
def credentials=(value); end
|
| 77 |
|
| 78 |
sig { returns(T.nilable(WorkOS::DataIntegrationInstallation)) }
|
ruby/rbi/workos/data_integrations_list_response_data_connected_account.rbi|
@@ -51,6 +51,24 @@ module WorkOS
|
|
| 51 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 52 |
def api_key_last_4=(value); end
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
sig { returns(String) }
|
| 55 |
def state; end
|
| 56 |
|
|
|
|
| 51 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 52 |
def api_key_last_4=(value); end
|
| 53 |
|
| 54 |
+
sig { returns(T.nilable(String)) }
|
| 55 |
+
def client_id; end
|
| 56 |
+
|
| 57 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 58 |
+
def client_id=(value); end
|
| 59 |
+
|
| 60 |
+
sig { returns(T.nilable(String)) }
|
| 61 |
+
def client_secret_last_4; end
|
| 62 |
+
|
| 63 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 64 |
+
def client_secret_last_4=(value); end
|
| 65 |
+
|
| 66 |
+
sig { returns(T.nilable(T::Hash[String, String])) }
|
| 67 |
+
def config; end
|
| 68 |
+
|
| 69 |
+
sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) }
|
| 70 |
+
def config=(value); end
|
| 71 |
+
|
| 72 |
sig { returns(String) }
|
| 73 |
def state; end
|
| 74 |
|
ruby/rbi/workos/data_integrations_upsert_client_credentials_request.rbi|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# frozen_string_literal: true
|
| 2 |
+
|
| 3 |
+
# This file is auto-generated by oagen. Do not edit.
|
| 4 |
+
|
| 5 |
+
# typed: strong
|
| 6 |
+
|
| 7 |
+
module WorkOS
|
| 8 |
+
class DataIntegrationsUpsertClientCredentialsRequest
|
| 9 |
+
sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void }
|
| 10 |
+
def initialize(json); end
|
| 11 |
+
|
| 12 |
+
sig { returns(String) }
|
| 13 |
+
def user_id; end
|
| 14 |
+
|
| 15 |
+
sig { params(value: String).returns(String) }
|
| 16 |
+
def user_id=(value); end
|
| 17 |
+
|
| 18 |
+
sig { returns(T.nilable(String)) }
|
| 19 |
+
def organization_id; end
|
| 20 |
+
|
| 21 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 22 |
+
def organization_id=(value); end
|
| 23 |
+
|
| 24 |
+
sig { returns(String) }
|
| 25 |
+
def client_id; end
|
| 26 |
+
|
| 27 |
+
sig { params(value: String).returns(String) }
|
| 28 |
+
def client_id=(value); end
|
| 29 |
+
|
| 30 |
+
sig { returns(String) }
|
| 31 |
+
def client_secret; end
|
| 32 |
+
|
| 33 |
+
sig { params(value: String).returns(String) }
|
| 34 |
+
def client_secret=(value); end
|
| 35 |
+
|
| 36 |
+
sig { returns(T.nilable(T::Hash[String, String])) }
|
| 37 |
+
def config; end
|
| 38 |
+
|
| 39 |
+
sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) }
|
| 40 |
+
def config=(value); end
|
| 41 |
+
|
| 42 |
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
| 43 |
+
def to_h; end
|
| 44 |
+
|
| 45 |
+
sig { params(args: T.untyped).returns(String) }
|
| 46 |
+
def to_json(*args); end
|
| 47 |
+
end
|
| 48 |
+
end
|
ruby/rbi/workos/pipes.rbi|
@@ -89,6 +89,19 @@ module WorkOS
|
|
| 89 |
end
|
| 90 |
def authorize_data_integration(slug:, user_id:, organization_id:, return_to:, config:, request_options:); end
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
sig do
|
| 93 |
params(
|
| 94 |
slug: String,
|
|
|
|
| 89 |
end
|
| 90 |
def authorize_data_integration(slug:, user_id:, organization_id:, return_to:, config:, request_options:); end
|
| 91 |
|
| 92 |
+
sig do
|
| 93 |
+
params(
|
| 94 |
+
slug: String,
|
| 95 |
+
user_id: String,
|
| 96 |
+
client_id: String,
|
| 97 |
+
client_secret: String,
|
| 98 |
+
organization_id: T.nilable(String),
|
| 99 |
+
config: T.nilable(T::Hash[String, String]),
|
| 100 |
+
request_options: T::Hash[Symbol, T.untyped]
|
| 101 |
+
).returns(WorkOS::ConnectedAccount)
|
| 102 |
+
end
|
| 103 |
+
def update_data_integration_client_credentials(slug:, user_id:, client_id:, client_secret:, organization_id:, config:, request_options:); end
|
| 104 |
+
|
| 105 |
sig do
|
| 106 |
params(
|
| 107 |
slug: String,
|
ruby/rbi/workos/radar_sms_challenge_code_session_authenticate_request.rbi|
@@ -33,16 +33,16 @@ module WorkOS
|
|
| 33 |
sig { params(value: String).returns(String) }
|
| 34 |
def code=(value); end
|
| 35 |
|
| 36 |
-
sig { returns(String) }
|
| 37 |
def verification_id; end
|
| 38 |
|
| 39 |
-
sig { params(value: String).returns(String) }
|
| 40 |
def verification_id=(value); end
|
| 41 |
|
| 42 |
-
sig { returns(String) }
|
| 43 |
def phone_number; end
|
| 44 |
|
| 45 |
-
sig { params(value: String).returns(String) }
|
| 46 |
def phone_number=(value); end
|
| 47 |
|
| 48 |
sig { returns(String) }
|
|
|
|
| 33 |
sig { params(value: String).returns(String) }
|
| 34 |
def code=(value); end
|
| 35 |
|
| 36 |
+
sig { returns(T.nilable(String)) }
|
| 37 |
def verification_id; end
|
| 38 |
|
| 39 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 40 |
def verification_id=(value); end
|
| 41 |
|
| 42 |
+
sig { returns(T.nilable(String)) }
|
| 43 |
def phone_number; end
|
| 44 |
|
| 45 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 46 |
def phone_number=(value); end
|
| 47 |
|
| 48 |
sig { returns(String) }
|
ruby/rbi/workos/waitlist_user.rbi|
@@ -39,6 +39,12 @@ module WorkOS
|
|
| 39 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 40 |
def approved_at=(value); end
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
sig { returns(String) }
|
| 43 |
def created_at; end
|
| 44 |
|
|
|
|
| 39 |
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 40 |
def approved_at=(value); end
|
| 41 |
|
| 42 |
+
sig { returns(T.nilable(String)) }
|
| 43 |
+
def waitlist_id; end
|
| 44 |
+
|
| 45 |
+
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
|
| 46 |
+
def waitlist_id=(value); end
|
| 47 |
+
|
| 48 |
sig { returns(String) }
|
| 49 |
def created_at; end
|
| 50 |
|
ruby/test/workos/test_pipes.rb|
@@ -60,6 +60,13 @@ class PipesTest < Minitest::Test
|
|
| 60 |
refute_nil result
|
| 61 |
end
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
def test_create_data_integration_credential_returns_expected_result
|
| 64 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)})
|
| 65 |
.to_return(body: "{}", status: 200)
|
|
@@ -118,6 +125,7 @@ class PipesTest < Minitest::Test
|
|
| 118 |
{name: :delete_data_integration, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
|
| 119 |
{name: :update_data_integration_api_key, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}, args: {slug: "stub", user_id: "stub", secret: "stub"}},
|
| 120 |
{name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
|
|
|
| 121 |
{name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
| 122 |
{name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
|
| 123 |
{name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
|
|
|
|
| 60 |
refute_nil result
|
| 61 |
end
|
| 62 |
|
| 63 |
+
def test_update_data_integration_client_credentials_returns_expected_result
|
| 64 |
+
stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub/client-credentials(\?|\z)})
|
| 65 |
+
.to_return(body: "{}", status: 200)
|
| 66 |
+
result = @client.pipes.update_data_integration_client_credentials(slug: "stub", user_id: "stub", client_id: "stub", client_secret: "stub")
|
| 67 |
+
refute_nil result
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
def test_create_data_integration_credential_returns_expected_result
|
| 71 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)})
|
| 72 |
.to_return(body: "{}", status: 200)
|
|
|
|
| 125 |
{name: :delete_data_integration, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
|
| 126 |
{name: :update_data_integration_api_key, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}, args: {slug: "stub", user_id: "stub", secret: "stub"}},
|
| 127 |
{name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
| 128 |
+
{name: :update_data_integration_client_credentials, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/client-credentials(\?|\z)}, args: {slug: "stub", user_id: "stub", client_id: "stub", client_secret: "stub"}},
|
| 129 |
{name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
| 130 |
{name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
|
| 131 |
{name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
|
ruby/test/workos/test_pipes_model_round_trip.rb|
@@ -49,8 +49,6 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
| 49 |
json = model.to_h
|
| 50 |
assert_kind_of Hash, json
|
| 51 |
assert_equal fixture["name"], json[:name]
|
| 52 |
-
assert_equal fixture["authorization_url"], json[:authorization_url]
|
| 53 |
-
assert_equal fixture["token_url"], json[:token_url]
|
| 54 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 55 |
end
|
| 56 |
|
|
@@ -134,7 +132,7 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
| 134 |
"scopes" => nil,
|
| 135 |
"redirect_uri" => "stub",
|
| 136 |
"auth_methods" => [],
|
| 137 |
-
"credentials" =>
|
| 138 |
"installation" => nil,
|
| 139 |
"config" => {},
|
| 140 |
"custom_provider" => nil,
|
|
@@ -199,6 +197,9 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
| 199 |
"scopes" => [],
|
| 200 |
"auth_method" => "stub",
|
| 201 |
"api_key_last_4" => nil,
|
|
|
|
|
|
|
|
|
|
| 202 |
"state" => "stub",
|
| 203 |
"created_at" => "stub",
|
| 204 |
"updated_at" => "stub"
|
|
@@ -376,6 +377,23 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
| 376 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 377 |
end
|
| 378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
def test_data_integrations_vend_credentials_request_round_trip
|
| 380 |
fixture = {
|
| 381 |
"user_id" => "stub",
|
|
@@ -409,6 +427,9 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
| 409 |
"scopes" => [],
|
| 410 |
"auth_method" => "stub",
|
| 411 |
"api_key_last_4" => nil,
|
|
|
|
|
|
|
|
|
|
| 412 |
"state" => "stub",
|
| 413 |
"created_at" => "stub",
|
| 414 |
"updated_at" => "stub",
|
|
|
|
| 49 |
json = model.to_h
|
| 50 |
assert_kind_of Hash, json
|
| 51 |
assert_equal fixture["name"], json[:name]
|
|
|
|
|
|
|
| 52 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 53 |
end
|
| 54 |
|
|
|
|
| 132 |
"scopes" => nil,
|
| 133 |
"redirect_uri" => "stub",
|
| 134 |
"auth_methods" => [],
|
| 135 |
+
"credentials" => nil,
|
| 136 |
"installation" => nil,
|
| 137 |
"config" => {},
|
| 138 |
"custom_provider" => nil,
|
|
|
|
| 197 |
"scopes" => [],
|
| 198 |
"auth_method" => "stub",
|
| 199 |
"api_key_last_4" => nil,
|
| 200 |
+
"client_id" => nil,
|
| 201 |
+
"client_secret_last_4" => nil,
|
| 202 |
+
"config" => {},
|
| 203 |
"state" => "stub",
|
| 204 |
"created_at" => "stub",
|
| 205 |
"updated_at" => "stub"
|
|
|
|
| 377 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 378 |
end
|
| 379 |
|
| 380 |
+
def test_data_integrations_upsert_client_credentials_request_round_trip
|
| 381 |
+
fixture = {
|
| 382 |
+
"user_id" => "stub",
|
| 383 |
+
"organization_id" => "stub",
|
| 384 |
+
"client_id" => "stub",
|
| 385 |
+
"client_secret" => "stub",
|
| 386 |
+
"config" => {}
|
| 387 |
+
}
|
| 388 |
+
model = WorkOS::DataIntegrationsUpsertClientCredentialsRequest.new(fixture.to_json)
|
| 389 |
+
json = model.to_h
|
| 390 |
+
assert_kind_of Hash, json
|
| 391 |
+
assert_equal fixture["user_id"], json[:user_id]
|
| 392 |
+
assert_equal fixture["client_id"], json[:client_id]
|
| 393 |
+
assert_equal fixture["client_secret"], json[:client_secret]
|
| 394 |
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 395 |
+
end
|
| 396 |
+
|
| 397 |
def test_data_integrations_vend_credentials_request_round_trip
|
| 398 |
fixture = {
|
| 399 |
"user_id" => "stub",
|
|
|
|
| 427 |
"scopes" => [],
|
| 428 |
"auth_method" => "stub",
|
| 429 |
"api_key_last_4" => nil,
|
| 430 |
+
"client_id" => nil,
|
| 431 |
+
"client_secret_last_4" => nil,
|
| 432 |
+
"config" => {},
|
| 433 |
"state" => "stub",
|
| 434 |
"created_at" => "stub",
|
| 435 |
"updated_at" => "stub",
|
ruby/test/workos/test_user_management.rb|
@@ -163,7 +163,7 @@ class UserManagementTest < Minitest::Test
|
|
| 163 |
def test_authenticate_with_radar_sms_challenge_returns_expected_result
|
| 164 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
| 165 |
.to_return(body: "{}", status: 200)
|
| 166 |
-
result = @client.user_management.authenticate_with_radar_sms_challenge(code: "stub",
|
| 167 |
refute_nil result
|
| 168 |
end
|
| 169 |
|
|
@@ -171,7 +171,7 @@ class UserManagementTest < Minitest::Test
|
|
| 171 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
| 172 |
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
| 173 |
assert_raises(WorkOS::AuthenticationError) do
|
| 174 |
-
@client.user_management.authenticate_with_radar_sms_challenge(code: "stub",
|
| 175 |
end
|
| 176 |
end
|
| 177 |
|
|
|
|
| 163 |
def test_authenticate_with_radar_sms_challenge_returns_expected_result
|
| 164 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
| 165 |
.to_return(body: "{}", status: 200)
|
| 166 |
+
result = @client.user_management.authenticate_with_radar_sms_challenge(code: "stub", pending_authentication_token: "stub")
|
| 167 |
refute_nil result
|
| 168 |
end
|
| 169 |
|
|
|
|
| 171 |
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
| 172 |
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
| 173 |
assert_raises(WorkOS::AuthenticationError) do
|
| 174 |
+
@client.user_management.authenticate_with_radar_sms_challenge(code: "stub", pending_authentication_token: "stub")
|
| 175 |
end
|
| 176 |
end
|
| 177 |
|
ruby/test/workos/test_user_management_model_round_trip.rb|
@@ -2356,8 +2356,6 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
| 2356 |
assert_equal fixture["client_id"], json[:client_id]
|
| 2357 |
assert_equal fixture["client_secret"], json[:client_secret]
|
| 2358 |
assert_equal fixture["code"], json[:code]
|
| 2359 |
-
assert_equal fixture["verification_id"], json[:verification_id]
|
| 2360 |
-
assert_equal fixture["phone_number"], json[:phone_number]
|
| 2361 |
assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token]
|
| 2362 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 2363 |
end
|
|
|
|
| 2356 |
assert_equal fixture["client_id"], json[:client_id]
|
| 2357 |
assert_equal fixture["client_secret"], json[:client_secret]
|
| 2358 |
assert_equal fixture["code"], json[:code]
|
|
|
|
|
|
|
| 2359 |
assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token]
|
| 2360 |
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
| 2361 |
end
|
All files in this language are hidden by the current filters.
code: 32 ยท tests: 0 ยท manifest: 1
rust/.oagen-manifest.json|
@@ -180,6 +180,8 @@
|
|
| 180 |
"src/models/agent_registration_expired_data.rs",
|
| 181 |
"src/models/agent_registration_organization_switched.rs",
|
| 182 |
"src/models/agent_registration_organization_switched_data.rs",
|
|
|
|
|
|
|
| 183 |
"src/models/agent_registration_revoked.rs",
|
| 184 |
"src/models/agent_registration_revoked_data.rs",
|
| 185 |
"src/models/api_key.rs",
|
|
@@ -375,6 +377,7 @@
|
|
| 375 |
"src/models/data_integrations_list_response_data.rs",
|
| 376 |
"src/models/data_integrations_list_response_data_connected_account.rs",
|
| 377 |
"src/models/data_integrations_upsert_api_key_request.rs",
|
|
|
|
| 378 |
"src/models/data_integrations_vend_credentials_request.rs",
|
| 379 |
"src/models/decrypt_request.rs",
|
| 380 |
"src/models/decrypt_response.rs",
|
|
@@ -791,6 +794,8 @@
|
|
| 791 |
"tests/fixtures/agent_registration_expired_data.json",
|
| 792 |
"tests/fixtures/agent_registration_organization_switched.json",
|
| 793 |
"tests/fixtures/agent_registration_organization_switched_data.json",
|
|
|
|
|
|
|
| 794 |
"tests/fixtures/agent_registration_revoked.json",
|
| 795 |
"tests/fixtures/agent_registration_revoked_data.json",
|
| 796 |
"tests/fixtures/api_key.json",
|
|
@@ -984,6 +989,7 @@
|
|
| 984 |
"tests/fixtures/data_integrations_list_response_data.json",
|
| 985 |
"tests/fixtures/data_integrations_list_response_data_connected_account.json",
|
| 986 |
"tests/fixtures/data_integrations_upsert_api_key_request.json",
|
|
|
|
| 987 |
"tests/fixtures/data_integrations_vend_credentials_request.json",
|
| 988 |
"tests/fixtures/decrypt_request.json",
|
| 989 |
"tests/fixtures/decrypt_response.json",
|
|
@@ -1666,6 +1672,10 @@
|
|
| 1666 |
"sdkMethod": "authorize_data_integration",
|
| 1667 |
"service": "pipes"
|
| 1668 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1669 |
"POST /data-integrations/{slug}/credentials": {
|
| 1670 |
"sdkMethod": "create_data_integration_credential",
|
| 1671 |
"service": "pipes"
|
|
|
|
| 180 |
"src/models/agent_registration_expired_data.rs",
|
| 181 |
"src/models/agent_registration_organization_switched.rs",
|
| 182 |
"src/models/agent_registration_organization_switched_data.rs",
|
| 183 |
+
"src/models/agent_registration_refreshed.rs",
|
| 184 |
+
"src/models/agent_registration_refreshed_data.rs",
|
| 185 |
"src/models/agent_registration_revoked.rs",
|
| 186 |
"src/models/agent_registration_revoked_data.rs",
|
| 187 |
"src/models/api_key.rs",
|
|
|
|
| 377 |
"src/models/data_integrations_list_response_data.rs",
|
| 378 |
"src/models/data_integrations_list_response_data_connected_account.rs",
|
| 379 |
"src/models/data_integrations_upsert_api_key_request.rs",
|
| 380 |
+
"src/models/data_integrations_upsert_client_credentials_request.rs",
|
| 381 |
"src/models/data_integrations_vend_credentials_request.rs",
|
| 382 |
"src/models/decrypt_request.rs",
|
| 383 |
"src/models/decrypt_response.rs",
|
|
|
|
| 794 |
"tests/fixtures/agent_registration_expired_data.json",
|
| 795 |
"tests/fixtures/agent_registration_organization_switched.json",
|
| 796 |
"tests/fixtures/agent_registration_organization_switched_data.json",
|
| 797 |
+
"tests/fixtures/agent_registration_refreshed.json",
|
| 798 |
+
"tests/fixtures/agent_registration_refreshed_data.json",
|
| 799 |
"tests/fixtures/agent_registration_revoked.json",
|
| 800 |
"tests/fixtures/agent_registration_revoked_data.json",
|
| 801 |
"tests/fixtures/api_key.json",
|
|
|
|
| 989 |
"tests/fixtures/data_integrations_list_response_data.json",
|
| 990 |
"tests/fixtures/data_integrations_list_response_data_connected_account.json",
|
| 991 |
"tests/fixtures/data_integrations_upsert_api_key_request.json",
|
| 992 |
+
"tests/fixtures/data_integrations_upsert_client_credentials_request.json",
|
| 993 |
"tests/fixtures/data_integrations_vend_credentials_request.json",
|
| 994 |
"tests/fixtures/decrypt_request.json",
|
| 995 |
"tests/fixtures/decrypt_response.json",
|
|
|
|
| 1672 |
"sdkMethod": "authorize_data_integration",
|
| 1673 |
"service": "pipes"
|
| 1674 |
},
|
| 1675 |
+
"PUT /data-integrations/{slug}/client-credentials": {
|
| 1676 |
+
"sdkMethod": "update_data_integration_client_credentials",
|
| 1677 |
+
"service": "pipes"
|
| 1678 |
+
},
|
| 1679 |
"POST /data-integrations/{slug}/credentials": {
|
| 1680 |
"sdkMethod": "create_data_integration_credential",
|
| 1681 |
"service": "pipes"
|
rust/src/enums/authenticate_response_authentication_method.rs|
@@ -18,6 +18,8 @@ pub enum AuthenticateResponseAuthenticationMethod {
|
|
| 18 |
GitHubOAuth,
|
| 19 |
GitLabOAuth,
|
| 20 |
GoogleOAuth,
|
|
|
|
|
|
|
| 21 |
IntuitOAuth,
|
| 22 |
LinkedInOAuth,
|
| 23 |
MicrosoftOAuth,
|
|
@@ -53,6 +55,8 @@ impl AuthenticateResponseAuthenticationMethod {
|
|
| 53 |
Self::GitHubOAuth => "GitHubOAuth",
|
| 54 |
Self::GitLabOAuth => "GitLabOAuth",
|
| 55 |
Self::GoogleOAuth => "GoogleOAuth",
|
|
|
|
|
|
|
| 56 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 57 |
Self::LinkedInOAuth => "LinkedInOAuth",
|
| 58 |
Self::MicrosoftOAuth => "MicrosoftOAuth",
|
|
@@ -97,6 +101,8 @@ impl FromStr for AuthenticateResponseAuthenticationMethod {
|
|
| 97 |
"GitHubOAuth" => Self::GitHubOAuth,
|
| 98 |
"GitLabOAuth" => Self::GitLabOAuth,
|
| 99 |
"GoogleOAuth" => Self::GoogleOAuth,
|
|
|
|
|
|
|
| 100 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 101 |
"LinkedInOAuth" => Self::LinkedInOAuth,
|
| 102 |
"MicrosoftOAuth" => Self::MicrosoftOAuth,
|
|
|
|
| 18 |
GitHubOAuth,
|
| 19 |
GitLabOAuth,
|
| 20 |
GoogleOAuth,
|
| 21 |
+
GrokOAuth,
|
| 22 |
+
XoAuth,
|
| 23 |
IntuitOAuth,
|
| 24 |
LinkedInOAuth,
|
| 25 |
MicrosoftOAuth,
|
|
|
|
| 55 |
Self::GitHubOAuth => "GitHubOAuth",
|
| 56 |
Self::GitLabOAuth => "GitLabOAuth",
|
| 57 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 58 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 59 |
+
Self::XoAuth => "XOAuth",
|
| 60 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 61 |
Self::LinkedInOAuth => "LinkedInOAuth",
|
| 62 |
Self::MicrosoftOAuth => "MicrosoftOAuth",
|
|
|
|
| 101 |
"GitHubOAuth" => Self::GitHubOAuth,
|
| 102 |
"GitLabOAuth" => Self::GitLabOAuth,
|
| 103 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 104 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 105 |
+
"XOAuth" => Self::XoAuth,
|
| 106 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 107 |
"LinkedInOAuth" => Self::LinkedInOAuth,
|
| 108 |
"MicrosoftOAuth" => Self::MicrosoftOAuth,
|
rust/src/enums/connection_activated_data_connection_type.rs|
@@ -29,6 +29,8 @@ pub enum ConnectionActivatedDataConnectionType {
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
|
|
|
|
|
|
| 32 |
IntuitOAuth,
|
| 33 |
JumpCloudSAML,
|
| 34 |
KeycloakSAML,
|
|
@@ -92,6 +94,8 @@ impl ConnectionActivatedDataConnectionType {
|
|
| 92 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 93 |
Self::GoogleOidc => "GoogleOIDC",
|
| 94 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 95 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 96 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 97 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -164,6 +168,8 @@ impl FromStr for ConnectionActivatedDataConnectionType {
|
|
| 164 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 165 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 166 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 167 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 168 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 169 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
| 32 |
+
GrokOAuth,
|
| 33 |
+
XoAuth,
|
| 34 |
IntuitOAuth,
|
| 35 |
JumpCloudSAML,
|
| 36 |
KeycloakSAML,
|
|
|
|
| 94 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 95 |
Self::GoogleOidc => "GoogleOIDC",
|
| 96 |
Self::GoogleSAML => "GoogleSAML",
|
| 97 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 98 |
+
Self::XoAuth => "XOAuth",
|
| 99 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 100 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 101 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 168 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 169 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 170 |
"GoogleSAML" => Self::GoogleSAML,
|
| 171 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 172 |
+
"XOAuth" => Self::XoAuth,
|
| 173 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 174 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 175 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/connection_deactivated_data_connection_type.rs|
@@ -29,6 +29,8 @@ pub enum ConnectionDeactivatedDataConnectionType {
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
|
|
|
|
|
|
| 32 |
IntuitOAuth,
|
| 33 |
JumpCloudSAML,
|
| 34 |
KeycloakSAML,
|
|
@@ -92,6 +94,8 @@ impl ConnectionDeactivatedDataConnectionType {
|
|
| 92 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 93 |
Self::GoogleOidc => "GoogleOIDC",
|
| 94 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 95 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 96 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 97 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -164,6 +168,8 @@ impl FromStr for ConnectionDeactivatedDataConnectionType {
|
|
| 164 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 165 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 166 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 167 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 168 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 169 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
| 32 |
+
GrokOAuth,
|
| 33 |
+
XoAuth,
|
| 34 |
IntuitOAuth,
|
| 35 |
JumpCloudSAML,
|
| 36 |
KeycloakSAML,
|
|
|
|
| 94 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 95 |
Self::GoogleOidc => "GoogleOIDC",
|
| 96 |
Self::GoogleSAML => "GoogleSAML",
|
| 97 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 98 |
+
Self::XoAuth => "XOAuth",
|
| 99 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 100 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 101 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 168 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 169 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 170 |
"GoogleSAML" => Self::GoogleSAML,
|
| 171 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 172 |
+
"XOAuth" => Self::XoAuth,
|
| 173 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 174 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 175 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/connection_deleted_data_connection_type.rs|
@@ -29,6 +29,8 @@ pub enum ConnectionDeletedDataConnectionType {
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
|
|
|
|
|
|
| 32 |
IntuitOAuth,
|
| 33 |
JumpCloudSAML,
|
| 34 |
KeycloakSAML,
|
|
@@ -92,6 +94,8 @@ impl ConnectionDeletedDataConnectionType {
|
|
| 92 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 93 |
Self::GoogleOidc => "GoogleOIDC",
|
| 94 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 95 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 96 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 97 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -164,6 +168,8 @@ impl FromStr for ConnectionDeletedDataConnectionType {
|
|
| 164 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 165 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 166 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 167 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 168 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 169 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 29 |
GoogleOAuth,
|
| 30 |
GoogleOidc,
|
| 31 |
GoogleSAML,
|
| 32 |
+
GrokOAuth,
|
| 33 |
+
XoAuth,
|
| 34 |
IntuitOAuth,
|
| 35 |
JumpCloudSAML,
|
| 36 |
KeycloakSAML,
|
|
|
|
| 94 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 95 |
Self::GoogleOidc => "GoogleOIDC",
|
| 96 |
Self::GoogleSAML => "GoogleSAML",
|
| 97 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 98 |
+
Self::XoAuth => "XOAuth",
|
| 99 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 100 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 101 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 168 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 169 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 170 |
"GoogleSAML" => Self::GoogleSAML,
|
| 171 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 172 |
+
"XOAuth" => Self::XoAuth,
|
| 173 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 174 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 175 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/connection_type.rs|
@@ -30,6 +30,8 @@ pub enum ConnectionType {
|
|
| 30 |
GoogleOAuth,
|
| 31 |
GoogleOidc,
|
| 32 |
GoogleSAML,
|
|
|
|
|
|
|
| 33 |
IntuitOAuth,
|
| 34 |
JumpCloudSAML,
|
| 35 |
KeycloakSAML,
|
|
@@ -94,6 +96,8 @@ impl ConnectionType {
|
|
| 94 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 95 |
Self::GoogleOidc => "GoogleOIDC",
|
| 96 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 97 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 98 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 99 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -167,6 +171,8 @@ impl FromStr for ConnectionType {
|
|
| 167 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 168 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 169 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 170 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 171 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 172 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 30 |
GoogleOAuth,
|
| 31 |
GoogleOidc,
|
| 32 |
GoogleSAML,
|
| 33 |
+
GrokOAuth,
|
| 34 |
+
XoAuth,
|
| 35 |
IntuitOAuth,
|
| 36 |
JumpCloudSAML,
|
| 37 |
KeycloakSAML,
|
|
|
|
| 96 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 97 |
Self::GoogleOidc => "GoogleOIDC",
|
| 98 |
Self::GoogleSAML => "GoogleSAML",
|
| 99 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 100 |
+
Self::XoAuth => "XOAuth",
|
| 101 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 102 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 103 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 171 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 172 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 173 |
"GoogleSAML" => Self::GoogleSAML,
|
| 174 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 175 |
+
"XOAuth" => Self::XoAuth,
|
| 176 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 177 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 178 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/connections_connection_type.rs|
@@ -28,6 +28,8 @@ pub enum ConnectionsConnectionType {
|
|
| 28 |
GoogleOAuth,
|
| 29 |
GoogleOidc,
|
| 30 |
GoogleSAML,
|
|
|
|
|
|
|
| 31 |
IntuitOAuth,
|
| 32 |
JumpCloudSAML,
|
| 33 |
KeycloakSAML,
|
|
@@ -89,6 +91,8 @@ impl ConnectionsConnectionType {
|
|
| 89 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 90 |
Self::GoogleOidc => "GoogleOIDC",
|
| 91 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 92 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 93 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 94 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -159,6 +163,8 @@ impl FromStr for ConnectionsConnectionType {
|
|
| 159 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 160 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 161 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 162 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 163 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 164 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 28 |
GoogleOAuth,
|
| 29 |
GoogleOidc,
|
| 30 |
GoogleSAML,
|
| 31 |
+
GrokOAuth,
|
| 32 |
+
XoAuth,
|
| 33 |
IntuitOAuth,
|
| 34 |
JumpCloudSAML,
|
| 35 |
KeycloakSAML,
|
|
|
|
| 91 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 92 |
Self::GoogleOidc => "GoogleOIDC",
|
| 93 |
Self::GoogleSAML => "GoogleSAML",
|
| 94 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 95 |
+
Self::XoAuth => "XOAuth",
|
| 96 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 97 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 98 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 163 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 164 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 165 |
"GoogleSAML" => Self::GoogleSAML,
|
| 166 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 167 |
+
"XOAuth" => Self::XoAuth,
|
| 168 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 169 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 170 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/create_data_integration_auth_methods.rs|
@@ -9,6 +9,7 @@ use std::str::FromStr;
|
|
| 9 |
pub enum CreateDataIntegrationAuthMethods {
|
| 10 |
OAuth,
|
| 11 |
ApiKey,
|
|
|
|
| 12 |
/// Wire value not recognized by this SDK version. The original
|
| 13 |
/// string is preserved verbatim. WorkOS may add new enum values
|
| 14 |
/// server-side; matching on this variant lets callers handle
|
|
@@ -24,6 +25,7 @@ impl CreateDataIntegrationAuthMethods {
|
|
| 24 |
match self {
|
| 25 |
Self::OAuth => "oauth",
|
| 26 |
Self::ApiKey => "api_key",
|
|
|
|
| 27 |
Self::Unknown(s) => s.as_str(),
|
| 28 |
}
|
| 29 |
}
|
|
@@ -48,6 +50,7 @@ impl FromStr for CreateDataIntegrationAuthMethods {
|
|
| 48 |
Ok(match s {
|
| 49 |
"oauth" => Self::OAuth,
|
| 50 |
"api_key" => Self::ApiKey,
|
|
|
|
| 51 |
other => Self::Unknown(other.to_string()),
|
| 52 |
})
|
| 53 |
}
|
|
|
|
| 9 |
pub enum CreateDataIntegrationAuthMethods {
|
| 10 |
OAuth,
|
| 11 |
ApiKey,
|
| 12 |
+
ClientCredentials,
|
| 13 |
/// Wire value not recognized by this SDK version. The original
|
| 14 |
/// string is preserved verbatim. WorkOS may add new enum values
|
| 15 |
/// server-side; matching on this variant lets callers handle
|
|
|
|
| 25 |
match self {
|
| 26 |
Self::OAuth => "oauth",
|
| 27 |
Self::ApiKey => "api_key",
|
| 28 |
+
Self::ClientCredentials => "client_credentials",
|
| 29 |
Self::Unknown(s) => s.as_str(),
|
| 30 |
}
|
| 31 |
}
|
|
|
|
| 50 |
Ok(match s {
|
| 51 |
"oauth" => Self::OAuth,
|
| 52 |
"api_key" => Self::ApiKey,
|
| 53 |
+
"client_credentials" => Self::ClientCredentials,
|
| 54 |
other => Self::Unknown(other.to_string()),
|
| 55 |
})
|
| 56 |
}
|
rust/src/enums/create_webhook_endpoint_events.rs|
@@ -12,6 +12,7 @@ pub enum CreateWebhookEndpointEvents {
|
|
| 12 |
AgentRegistrationClaimCompleted,
|
| 13 |
AgentRegistrationCredentialIssued,
|
| 14 |
AgentRegistrationDeleted,
|
|
|
|
| 15 |
AgentRegistrationExpired,
|
| 16 |
AgentRegistrationOrganizationSwitched,
|
| 17 |
AgentRegistrationRevoked,
|
|
@@ -119,6 +120,7 @@ impl CreateWebhookEndpointEvents {
|
|
| 119 |
Self::AgentRegistrationClaimCompleted => "agent.registration.claim.completed",
|
| 120 |
Self::AgentRegistrationCredentialIssued => "agent.registration.credential.issued",
|
| 121 |
Self::AgentRegistrationDeleted => "agent.registration.deleted",
|
|
|
|
| 122 |
Self::AgentRegistrationExpired => "agent.registration.expired",
|
| 123 |
Self::AgentRegistrationOrganizationSwitched => {
|
| 124 |
"agent.registration.organization.switched"
|
|
@@ -247,6 +249,7 @@ impl FromStr for CreateWebhookEndpointEvents {
|
|
| 247 |
"agent.registration.claim.completed" => Self::AgentRegistrationClaimCompleted,
|
| 248 |
"agent.registration.credential.issued" => Self::AgentRegistrationCredentialIssued,
|
| 249 |
"agent.registration.deleted" => Self::AgentRegistrationDeleted,
|
|
|
|
| 250 |
"agent.registration.expired" => Self::AgentRegistrationExpired,
|
| 251 |
"agent.registration.organization.switched" => {
|
| 252 |
Self::AgentRegistrationOrganizationSwitched
|
|
|
|
| 12 |
AgentRegistrationClaimCompleted,
|
| 13 |
AgentRegistrationCredentialIssued,
|
| 14 |
AgentRegistrationDeleted,
|
| 15 |
+
AgentRegistrationRefreshed,
|
| 16 |
AgentRegistrationExpired,
|
| 17 |
AgentRegistrationOrganizationSwitched,
|
| 18 |
AgentRegistrationRevoked,
|
|
|
|
| 120 |
Self::AgentRegistrationClaimCompleted => "agent.registration.claim.completed",
|
| 121 |
Self::AgentRegistrationCredentialIssued => "agent.registration.credential.issued",
|
| 122 |
Self::AgentRegistrationDeleted => "agent.registration.deleted",
|
| 123 |
+
Self::AgentRegistrationRefreshed => "agent.registration.refreshed",
|
| 124 |
Self::AgentRegistrationExpired => "agent.registration.expired",
|
| 125 |
Self::AgentRegistrationOrganizationSwitched => {
|
| 126 |
"agent.registration.organization.switched"
|
|
|
|
| 249 |
"agent.registration.claim.completed" => Self::AgentRegistrationClaimCompleted,
|
| 250 |
"agent.registration.credential.issued" => Self::AgentRegistrationCredentialIssued,
|
| 251 |
"agent.registration.deleted" => Self::AgentRegistrationDeleted,
|
| 252 |
+
"agent.registration.refreshed" => Self::AgentRegistrationRefreshed,
|
| 253 |
"agent.registration.expired" => Self::AgentRegistrationExpired,
|
| 254 |
"agent.registration.organization.switched" => {
|
| 255 |
Self::AgentRegistrationOrganizationSwitched
|
rust/src/enums/profile_connection_type.rs|
@@ -30,6 +30,8 @@ pub enum ProfileConnectionType {
|
|
| 30 |
GoogleOAuth,
|
| 31 |
GoogleOidc,
|
| 32 |
GoogleSAML,
|
|
|
|
|
|
|
| 33 |
IntuitOAuth,
|
| 34 |
JumpCloudSAML,
|
| 35 |
KeycloakSAML,
|
|
@@ -94,6 +96,8 @@ impl ProfileConnectionType {
|
|
| 94 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 95 |
Self::GoogleOidc => "GoogleOIDC",
|
| 96 |
Self::GoogleSAML => "GoogleSAML",
|
|
|
|
|
|
|
| 97 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 98 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 99 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
@@ -167,6 +171,8 @@ impl FromStr for ProfileConnectionType {
|
|
| 167 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 168 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 169 |
"GoogleSAML" => Self::GoogleSAML,
|
|
|
|
|
|
|
| 170 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 171 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 172 |
"KeycloakSAML" => Self::KeycloakSAML,
|
|
|
|
| 30 |
GoogleOAuth,
|
| 31 |
GoogleOidc,
|
| 32 |
GoogleSAML,
|
| 33 |
+
GrokOAuth,
|
| 34 |
+
XoAuth,
|
| 35 |
IntuitOAuth,
|
| 36 |
JumpCloudSAML,
|
| 37 |
KeycloakSAML,
|
|
|
|
| 96 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 97 |
Self::GoogleOidc => "GoogleOIDC",
|
| 98 |
Self::GoogleSAML => "GoogleSAML",
|
| 99 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 100 |
+
Self::XoAuth => "XOAuth",
|
| 101 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 102 |
Self::JumpCloudSAML => "JumpCloudSAML",
|
| 103 |
Self::KeycloakSAML => "KeycloakSAML",
|
|
|
|
| 171 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 172 |
"GoogleOIDC" => Self::GoogleOidc,
|
| 173 |
"GoogleSAML" => Self::GoogleSAML,
|
| 174 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 175 |
+
"XOAuth" => Self::XoAuth,
|
| 176 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 177 |
"JumpCloudSAML" => Self::JumpCloudSAML,
|
| 178 |
"KeycloakSAML" => Self::KeycloakSAML,
|
rust/src/enums/update_webhook_endpoint_events.rs|
@@ -12,6 +12,7 @@ pub enum UpdateWebhookEndpointEvents {
|
|
| 12 |
AgentRegistrationClaimCompleted,
|
| 13 |
AgentRegistrationCredentialIssued,
|
| 14 |
AgentRegistrationDeleted,
|
|
|
|
| 15 |
AgentRegistrationExpired,
|
| 16 |
AgentRegistrationOrganizationSwitched,
|
| 17 |
AgentRegistrationRevoked,
|
|
@@ -119,6 +120,7 @@ impl UpdateWebhookEndpointEvents {
|
|
| 119 |
Self::AgentRegistrationClaimCompleted => "agent.registration.claim.completed",
|
| 120 |
Self::AgentRegistrationCredentialIssued => "agent.registration.credential.issued",
|
| 121 |
Self::AgentRegistrationDeleted => "agent.registration.deleted",
|
|
|
|
| 122 |
Self::AgentRegistrationExpired => "agent.registration.expired",
|
| 123 |
Self::AgentRegistrationOrganizationSwitched => {
|
| 124 |
"agent.registration.organization.switched"
|
|
@@ -247,6 +249,7 @@ impl FromStr for UpdateWebhookEndpointEvents {
|
|
| 247 |
"agent.registration.claim.completed" => Self::AgentRegistrationClaimCompleted,
|
| 248 |
"agent.registration.credential.issued" => Self::AgentRegistrationCredentialIssued,
|
| 249 |
"agent.registration.deleted" => Self::AgentRegistrationDeleted,
|
|
|
|
| 250 |
"agent.registration.expired" => Self::AgentRegistrationExpired,
|
| 251 |
"agent.registration.organization.switched" => {
|
| 252 |
Self::AgentRegistrationOrganizationSwitched
|
|
|
|
| 12 |
AgentRegistrationClaimCompleted,
|
| 13 |
AgentRegistrationCredentialIssued,
|
| 14 |
AgentRegistrationDeleted,
|
| 15 |
+
AgentRegistrationRefreshed,
|
| 16 |
AgentRegistrationExpired,
|
| 17 |
AgentRegistrationOrganizationSwitched,
|
| 18 |
AgentRegistrationRevoked,
|
|
|
|
| 120 |
Self::AgentRegistrationClaimCompleted => "agent.registration.claim.completed",
|
| 121 |
Self::AgentRegistrationCredentialIssued => "agent.registration.credential.issued",
|
| 122 |
Self::AgentRegistrationDeleted => "agent.registration.deleted",
|
| 123 |
+
Self::AgentRegistrationRefreshed => "agent.registration.refreshed",
|
| 124 |
Self::AgentRegistrationExpired => "agent.registration.expired",
|
| 125 |
Self::AgentRegistrationOrganizationSwitched => {
|
| 126 |
"agent.registration.organization.switched"
|
|
|
|
| 249 |
"agent.registration.claim.completed" => Self::AgentRegistrationClaimCompleted,
|
| 250 |
"agent.registration.credential.issued" => Self::AgentRegistrationCredentialIssued,
|
| 251 |
"agent.registration.deleted" => Self::AgentRegistrationDeleted,
|
| 252 |
+
"agent.registration.refreshed" => Self::AgentRegistrationRefreshed,
|
| 253 |
"agent.registration.expired" => Self::AgentRegistrationExpired,
|
| 254 |
"agent.registration.organization.switched" => {
|
| 255 |
Self::AgentRegistrationOrganizationSwitched
|
rust/src/enums/user_identities_get_item_provider.rs|
@@ -13,6 +13,8 @@ pub enum UserIdentitiesGetItemProvider {
|
|
| 13 |
GithubOAuth,
|
| 14 |
GitLabOAuth,
|
| 15 |
GoogleOAuth,
|
|
|
|
|
|
|
| 16 |
IntuitOAuth,
|
| 17 |
LinkedInOAuth,
|
| 18 |
MicrosoftOAuth,
|
|
@@ -40,6 +42,8 @@ impl UserIdentitiesGetItemProvider {
|
|
| 40 |
Self::GithubOAuth => "GithubOAuth",
|
| 41 |
Self::GitLabOAuth => "GitLabOAuth",
|
| 42 |
Self::GoogleOAuth => "GoogleOAuth",
|
|
|
|
|
|
|
| 43 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 44 |
Self::LinkedInOAuth => "LinkedInOAuth",
|
| 45 |
Self::MicrosoftOAuth => "MicrosoftOAuth",
|
|
@@ -76,6 +80,8 @@ impl FromStr for UserIdentitiesGetItemProvider {
|
|
| 76 |
"GithubOAuth" => Self::GithubOAuth,
|
| 77 |
"GitLabOAuth" => Self::GitLabOAuth,
|
| 78 |
"GoogleOAuth" => Self::GoogleOAuth,
|
|
|
|
|
|
|
| 79 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 80 |
"LinkedInOAuth" => Self::LinkedInOAuth,
|
| 81 |
"MicrosoftOAuth" => Self::MicrosoftOAuth,
|
|
|
|
| 13 |
GithubOAuth,
|
| 14 |
GitLabOAuth,
|
| 15 |
GoogleOAuth,
|
| 16 |
+
GrokOAuth,
|
| 17 |
+
XoAuth,
|
| 18 |
IntuitOAuth,
|
| 19 |
LinkedInOAuth,
|
| 20 |
MicrosoftOAuth,
|
|
|
|
| 42 |
Self::GithubOAuth => "GithubOAuth",
|
| 43 |
Self::GitLabOAuth => "GitLabOAuth",
|
| 44 |
Self::GoogleOAuth => "GoogleOAuth",
|
| 45 |
+
Self::GrokOAuth => "GrokOAuth",
|
| 46 |
+
Self::XoAuth => "XOAuth",
|
| 47 |
Self::IntuitOAuth => "IntuitOAuth",
|
| 48 |
Self::LinkedInOAuth => "LinkedInOAuth",
|
| 49 |
Self::MicrosoftOAuth => "MicrosoftOAuth",
|
|
|
|
| 80 |
"GithubOAuth" => Self::GithubOAuth,
|
| 81 |
"GitLabOAuth" => Self::GitLabOAuth,
|
| 82 |
"GoogleOAuth" => Self::GoogleOAuth,
|
| 83 |
+
"GrokOAuth" => Self::GrokOAuth,
|
| 84 |
+
"XOAuth" => Self::XoAuth,
|
| 85 |
"IntuitOAuth" => Self::IntuitOAuth,
|
| 86 |
"LinkedInOAuth" => Self::LinkedInOAuth,
|
| 87 |
"MicrosoftOAuth" => Self::MicrosoftOAuth,
|
rust/src/models/agent_registration_refreshed.rs|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
#[allow(unused_imports)]
|
| 4 |
+
use super::*;
|
| 5 |
+
#[allow(unused_imports)]
|
| 6 |
+
use crate::enums::*;
|
| 7 |
+
use serde::{Deserialize, Serialize};
|
| 8 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 9 |
+
pub struct AgentRegistrationRefreshed {
|
| 10 |
+
/// Distinguishes the Event object.
|
| 11 |
+
pub object: String,
|
| 12 |
+
/// Unique identifier for the event.
|
| 13 |
+
pub id: String,
|
| 14 |
+
pub event: String,
|
| 15 |
+
/// The event payload.
|
| 16 |
+
pub data: AgentRegistrationRefreshedData,
|
| 17 |
+
/// An ISO 8601 timestamp.
|
| 18 |
+
pub created_at: String,
|
| 19 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
+
pub context: Option<EventContext>,
|
| 21 |
+
}
|
rust/src/models/agent_registration_refreshed_data.rs|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
#[allow(unused_imports)]
|
| 4 |
+
use super::*;
|
| 5 |
+
#[allow(unused_imports)]
|
| 6 |
+
use crate::enums::*;
|
| 7 |
+
use serde::{Deserialize, Serialize};
|
| 8 |
+
/// The event payload.
|
| 9 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 10 |
+
pub struct AgentRegistrationRefreshedData {
|
| 11 |
+
/// The agent registration whose identity assertion was refreshed.
|
| 12 |
+
pub agent_registration_id: String,
|
| 13 |
+
}
|
rust/src/models/connected_account.rs|
@@ -25,6 +25,15 @@ pub struct ConnectedAccount {
|
|
| 25 |
/// The last four characters of the API key, or `null` for OAuth connections.
|
| 26 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 27 |
pub api_key_last_4: Option<String>,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
/// The state of the connected account:
|
| 29 |
/// - `connected`: The connection is active and tokens are valid.
|
| 30 |
/// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
|
|
|
| 25 |
/// The last four characters of the API key, or `null` for OAuth connections.
|
| 26 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 27 |
pub api_key_last_4: Option<String>,
|
| 28 |
+
/// The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.
|
| 29 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 30 |
+
pub client_id: Option<String>,
|
| 31 |
+
/// The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.
|
| 32 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 33 |
+
pub client_secret_last_4: Option<String>,
|
| 34 |
+
/// The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 35 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 36 |
+
pub config: Option<std::collections::HashMap<String, String>>,
|
| 37 |
/// The state of the connected account:
|
| 38 |
/// - `connected`: The connection is active and tokens are valid.
|
| 39 |
/// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
rust/src/models/create_data_integration.rs|
@@ -18,7 +18,7 @@ pub struct CreateDataIntegration {
|
|
| 18 |
/// The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 19 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
pub scopes: Option<Vec<String>>,
|
| 21 |
-
/// How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request).
|
| 22 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 23 |
pub auth_methods: Option<Vec<CreateDataIntegrationAuthMethods>>,
|
| 24 |
/// Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
|
|
|
| 18 |
/// The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.
|
| 19 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
pub scopes: Option<Vec<String>>,
|
| 21 |
+
/// How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.
|
| 22 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 23 |
pub auth_methods: Option<Vec<CreateDataIntegrationAuthMethods>>,
|
| 24 |
/// Provider-specific config values (e.g. a Snowflake `account_identifier`), keyed by the config field. Only fields the built-in provider declares are accepted.
|
rust/src/models/custom_provider_definition.rs|
@@ -9,10 +9,12 @@ use serde::{Deserialize, Serialize};
|
|
| 9 |
pub struct CustomProviderDefinition {
|
| 10 |
/// A descriptive name for the custom provider.
|
| 11 |
pub name: String,
|
| 12 |
-
/// The provider's OAuth authorization endpoint.
|
|
|
|
| 13 |
-
pub authorization_url: String,
|
| 14 |
-
/// The provider's OAuth token endpoint.
|
|
|
|
| 15 |
-
pub token_url: String,
|
| 16 |
/// The endpoint used to refresh tokens, if different from the token endpoint.
|
| 17 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 18 |
pub refresh_token_url: Option<String>,
|
|
|
|
| 9 |
pub struct CustomProviderDefinition {
|
| 10 |
/// A descriptive name for the custom provider.
|
| 11 |
pub name: String,
|
| 12 |
+
/// The provider's OAuth authorization endpoint. Required for OAuth providers; omit for `api_key` providers.
|
| 13 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 14 |
+
pub authorization_url: Option<String>,
|
| 15 |
+
/// The provider's OAuth token endpoint. Required for OAuth providers; omit for `api_key` providers.
|
| 16 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 17 |
+
pub token_url: Option<String>,
|
| 18 |
/// The endpoint used to refresh tokens, if different from the token endpoint.
|
| 19 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
pub refresh_token_url: Option<String>,
|
rust/src/models/data_integration.rs|
@@ -29,8 +29,9 @@ pub struct DataIntegration {
|
|
| 29 |
pub redirect_uri: String,
|
| 30 |
/// How accounts authenticate with the provider for this Data Integration.
|
| 31 |
pub auth_methods: Vec<DataIntegrationAuthMethods>,
|
| 32 |
-
/// The credentials
|
|
|
|
| 33 |
-
pub credentials: DataIntegrationCredential,
|
| 34 |
/// The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.
|
| 35 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 36 |
pub installation: Option<DataIntegrationInstallation>,
|
|
|
|
| 29 |
pub redirect_uri: String,
|
| 30 |
/// How accounts authenticate with the provider for this Data Integration.
|
| 31 |
pub auth_methods: Vec<DataIntegrationAuthMethods>,
|
| 32 |
+
/// The integration-level OAuth app credentials. `null` for `api_key` integrations, which hold no OAuth credentials (keys are installed per-tenant).
|
| 33 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 34 |
+
pub credentials: Option<DataIntegrationCredential>,
|
| 35 |
/// The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.
|
| 36 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 37 |
pub installation: Option<DataIntegrationInstallation>,
|
rust/src/models/data_integration_credential.rs|
@@ -5,7 +5,6 @@ use super::*;
|
|
| 5 |
#[allow(unused_imports)]
|
| 6 |
use crate::enums::*;
|
| 7 |
use serde::{Deserialize, Serialize};
|
| 8 |
-
/// The credentials configured for the Data Integration.
|
| 9 |
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 10 |
pub struct DataIntegrationCredential {
|
| 11 |
/// The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself).
|
|
|
|
| 5 |
#[allow(unused_imports)]
|
| 6 |
use crate::enums::*;
|
| 7 |
use serde::{Deserialize, Serialize};
|
|
|
|
| 8 |
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 9 |
pub struct DataIntegrationCredential {
|
| 10 |
/// The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself).
|
rust/src/models/data_integrations_list_response_data_connected_account.rs|
@@ -25,6 +25,15 @@ pub struct DataIntegrationsListResponseDataConnectedAccount {
|
|
| 25 |
/// The last four characters of the API key, or `null` for OAuth connections.
|
| 26 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 27 |
pub api_key_last_4: Option<String>,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
/// The state of the connected account:
|
| 29 |
/// - `connected`: The connection is active and tokens are valid.
|
| 30 |
/// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
|
|
|
| 25 |
/// The last four characters of the API key, or `null` for OAuth connections.
|
| 26 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 27 |
pub api_key_last_4: Option<String>,
|
| 28 |
+
/// The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.
|
| 29 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 30 |
+
pub client_id: Option<String>,
|
| 31 |
+
/// The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.
|
| 32 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 33 |
+
pub client_secret_last_4: Option<String>,
|
| 34 |
+
/// The connection-level configuration values stored for this connection โ the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.
|
| 35 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 36 |
+
pub config: Option<std::collections::HashMap<String, String>>,
|
| 37 |
/// The state of the connected account:
|
| 38 |
/// - `connected`: The connection is active and tokens are valid.
|
| 39 |
/// - `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed.
|
rust/src/models/data_integrations_upsert_client_credentials_request.rs|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// This file is auto-generated by oagen. Do not edit.
|
| 2 |
+
|
| 3 |
+
#[allow(unused_imports)]
|
| 4 |
+
use super::*;
|
| 5 |
+
#[allow(unused_imports)]
|
| 6 |
+
use crate::enums::*;
|
| 7 |
+
use serde::{Deserialize, Serialize};
|
| 8 |
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
| 9 |
+
pub struct DataIntegrationsUpsertClientCredentialsRequest {
|
| 10 |
+
/// A [User](https://workos.com/docs/reference/authkit/user) identifier.
|
| 11 |
+
pub user_id: String,
|
| 12 |
+
/// An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
|
| 13 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 14 |
+
pub organization_id: Option<String>,
|
| 15 |
+
/// The OAuth client ID to store for this integration.
|
| 16 |
+
pub client_id: String,
|
| 17 |
+
/// The OAuth client secret to store for this integration.
|
| 18 |
+
pub client_secret: crate::SecretString,
|
| 19 |
+
/// Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.
|
| 20 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 21 |
+
pub config: Option<std::collections::HashMap<String, String>>,
|
| 22 |
+
}
|
rust/src/models/mod.rs|
@@ -33,6 +33,8 @@ mod agent_registration_expired;
|
|
| 33 |
mod agent_registration_expired_data;
|
| 34 |
mod agent_registration_organization_switched;
|
| 35 |
mod agent_registration_organization_switched_data;
|
|
|
|
|
|
|
| 36 |
mod agent_registration_revoked;
|
| 37 |
mod agent_registration_revoked_data;
|
| 38 |
mod api_key;
|
|
@@ -228,6 +230,7 @@ mod data_integrations_list_response;
|
|
| 228 |
mod data_integrations_list_response_data;
|
| 229 |
mod data_integrations_list_response_data_connected_account;
|
| 230 |
mod data_integrations_upsert_api_key_request;
|
|
|
|
| 231 |
mod data_integrations_vend_credentials_request;
|
| 232 |
mod decrypt_request;
|
| 233 |
mod decrypt_response;
|
|
@@ -609,6 +612,8 @@ pub use agent_registration_expired::*;
|
|
| 609 |
pub use agent_registration_expired_data::*;
|
| 610 |
pub use agent_registration_organization_switched::*;
|
| 611 |
pub use agent_registration_organization_switched_data::*;
|
|
|
|
|
|
|
| 612 |
pub use agent_registration_revoked::*;
|
| 613 |
pub use agent_registration_revoked_data::*;
|
| 614 |
pub use api_key::*;
|
|
@@ -804,6 +809,7 @@ pub use data_integrations_list_response::*;
|
|
| 804 |
pub use data_integrations_list_response_data::*;
|
| 805 |
pub use data_integrations_list_response_data_connected_account::*;
|
| 806 |
pub use data_integrations_upsert_api_key_request::*;
|
|
|
|
| 807 |
pub use data_integrations_vend_credentials_request::*;
|
| 808 |
pub use decrypt_request::*;
|
| 809 |
pub use decrypt_response::*;
|
|
|
|
| 33 |
mod agent_registration_expired_data;
|
| 34 |
mod agent_registration_organization_switched;
|
| 35 |
mod agent_registration_organization_switched_data;
|
| 36 |
+
mod agent_registration_refreshed;
|
| 37 |
+
mod agent_registration_refreshed_data;
|
| 38 |
mod agent_registration_revoked;
|
| 39 |
mod agent_registration_revoked_data;
|
| 40 |
mod api_key;
|
|
|
|
| 230 |
mod data_integrations_list_response_data;
|
| 231 |
mod data_integrations_list_response_data_connected_account;
|
| 232 |
mod data_integrations_upsert_api_key_request;
|
| 233 |
+
mod data_integrations_upsert_client_credentials_request;
|
| 234 |
mod data_integrations_vend_credentials_request;
|
| 235 |
mod decrypt_request;
|
| 236 |
mod decrypt_response;
|
|
|
|
| 612 |
pub use agent_registration_expired_data::*;
|
| 613 |
pub use agent_registration_organization_switched::*;
|
| 614 |
pub use agent_registration_organization_switched_data::*;
|
| 615 |
+
pub use agent_registration_refreshed::*;
|
| 616 |
+
pub use agent_registration_refreshed_data::*;
|
| 617 |
pub use agent_registration_revoked::*;
|
| 618 |
pub use agent_registration_revoked_data::*;
|
| 619 |
pub use api_key::*;
|
|
|
|
| 809 |
pub use data_integrations_list_response_data::*;
|
| 810 |
pub use data_integrations_list_response_data_connected_account::*;
|
| 811 |
pub use data_integrations_upsert_api_key_request::*;
|
| 812 |
+
pub use data_integrations_upsert_client_credentials_request::*;
|
| 813 |
pub use data_integrations_vend_credentials_request::*;
|
| 814 |
pub use decrypt_request::*;
|
| 815 |
pub use decrypt_response::*;
|
rust/src/models/radar_sms_challenge_code_session_authenticate_request.rs|
@@ -14,10 +14,12 @@ pub struct RadarSmsChallengeCodeSessionAuthenticateRequest {
|
|
| 14 |
pub grant_type: String,
|
| 15 |
/// The one-time code from the Radar SMS challenge.
|
| 16 |
pub code: String,
|
| 17 |
-
/// The ID of the Radar SMS verification being confirmed.
|
|
|
|
| 18 |
-
pub verification_id: String,
|
| 19 |
-
/// The phone number the Radar SMS challenge was sent to.
|
|
|
|
| 20 |
-
pub phone_number: String,
|
| 21 |
/// The pending authentication token from a previous authentication attempt.
|
| 22 |
pub pending_authentication_token: crate::SecretString,
|
| 23 |
/// The IP address of the user's request.
|
|
|
|
| 14 |
pub grant_type: String,
|
| 15 |
/// The one-time code from the Radar SMS challenge.
|
| 16 |
pub code: String,
|
| 17 |
+
/// The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
| 18 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 19 |
+
pub verification_id: Option<String>,
|
| 20 |
+
/// The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
| 21 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 22 |
+
pub phone_number: Option<String>,
|
| 23 |
/// The pending authentication token from a previous authentication attempt.
|
| 24 |
pub pending_authentication_token: crate::SecretString,
|
| 25 |
/// The IP address of the user's request.
|
rust/src/models/waitlist_user.rs|
@@ -18,6 +18,9 @@ pub struct WaitlistUser {
|
|
| 18 |
/// The timestamp when the Waitlist User was approved, or null if not yet approved.
|
| 19 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
pub approved_at: Option<String>,
|
|
|
|
|
|
|
|
|
|
| 21 |
/// An ISO 8601 timestamp.
|
| 22 |
pub created_at: String,
|
| 23 |
/// An ISO 8601 timestamp.
|
|
|
|
| 18 |
/// The timestamp when the Waitlist User was approved, or null if not yet approved.
|
| 19 |
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 20 |
pub approved_at: Option<String>,
|
| 21 |
+
/// The unique ID of the Waitlist that the Waitlist User joined.
|
| 22 |
+
#[serde(skip_serializing_if = "Option::is_none", default)]
|
| 23 |
+
pub waitlist_id: Option<String>,
|
| 24 |
/// An ISO 8601 timestamp.
|
| 25 |
pub created_at: String,
|
| 26 |
/// An ISO 8601 timestamp.
|
rust/src/resources/pipes.rs|
@@ -112,6 +112,23 @@ impl AuthorizeDataIntegrationParams {
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
#[derive(Debug, Clone, Serialize)]
|
| 116 |
pub struct CreateDataIntegrationCredentialParams {
|
| 117 |
/// Request body sent with this call.
|
|
@@ -263,7 +280,7 @@ impl<'a> PipesApi<'a> {
|
|
| 263 |
|
| 264 |
/// Create a data integration
|
| 265 |
///
|
| 266 |
-
/// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 267 |
pub async fn create_data_integration(
|
| 268 |
&self,
|
| 269 |
params: CreateDataIntegrationParams,
|
|
@@ -408,6 +425,33 @@ impl<'a> PipesApi<'a> {
|
|
| 408 |
.await
|
| 409 |
}
|
| 410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
/// Vend credentials for a connected account
|
| 412 |
///
|
| 413 |
/// Returns credentials for a user's connected account. Branches on the installation's `auth_method`: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.
|
|
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
|
| 115 |
+
#[derive(Debug, Clone, Serialize)]
|
| 116 |
+
pub struct UpdateDataIntegrationClientCredentialsParams {
|
| 117 |
+
/// Request body sent with this call.
|
| 118 |
+
///
|
| 119 |
+
/// Required.
|
| 120 |
+
#[serde(skip)]
|
| 121 |
+
pub body: DataIntegrationsUpsertClientCredentialsRequest,
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
impl UpdateDataIntegrationClientCredentialsParams {
|
| 125 |
+
/// Construct a new `UpdateDataIntegrationClientCredentialsParams` with the required fields set.
|
| 126 |
+
#[allow(deprecated)]
|
| 127 |
+
pub fn new(body: DataIntegrationsUpsertClientCredentialsRequest) -> Self {
|
| 128 |
+
Self { body }
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
#[derive(Debug, Clone, Serialize)]
|
| 133 |
pub struct CreateDataIntegrationCredentialParams {
|
| 134 |
/// Request body sent with this call.
|
|
|
|
| 280 |
|
| 281 |
/// Create a data integration
|
| 282 |
///
|
| 283 |
+
/// Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition.
|
| 284 |
pub async fn create_data_integration(
|
| 285 |
&self,
|
| 286 |
params: CreateDataIntegrationParams,
|
|
|
|
| 425 |
.await
|
| 426 |
}
|
| 427 |
|
| 428 |
+
/// Upsert client credentials for a connected account
|
| 429 |
+
///
|
| 430 |
+
/// Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.
|
| 431 |
+
pub async fn update_data_integration_client_credentials(
|
| 432 |
+
&self,
|
| 433 |
+
slug: &str,
|
| 434 |
+
params: UpdateDataIntegrationClientCredentialsParams,
|
| 435 |
+
) -> Result<ConnectedAccount, Error> {
|
| 436 |
+
self.update_data_integration_client_credentials_with_options(slug, params, None)
|
| 437 |
+
.await
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
/// Variant of [`Self::update_data_integration_client_credentials`] that accepts per-request [`crate::RequestOptions`].
|
| 441 |
+
pub async fn update_data_integration_client_credentials_with_options(
|
| 442 |
+
&self,
|
| 443 |
+
slug: &str,
|
| 444 |
+
params: UpdateDataIntegrationClientCredentialsParams,
|
| 445 |
+
options: Option<&crate::RequestOptions>,
|
| 446 |
+
) -> Result<ConnectedAccount, Error> {
|
| 447 |
+
let slug = crate::client::path_segment(slug);
|
| 448 |
+
let path = format!("/data-integrations/{slug}/client-credentials");
|
| 449 |
+
let method = http::Method::PUT;
|
| 450 |
+
self.client
|
| 451 |
+
.request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options)
|
| 452 |
+
.await
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
/// Vend credentials for a connected account
|
| 456 |
///
|
| 457 |
/// Returns credentials for a user's connected account. Branches on the installation's `auth_method`: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.
|
rust/src/resources/user_management.rs|
@@ -477,14 +477,12 @@ pub struct AuthenticateWithRadarSmsChallengeParams {
|
|
| 477 |
///
|
| 478 |
/// Required.
|
| 479 |
pub code: String,
|
| 480 |
-
/// The ID of the Radar SMS verification being confirmed.
|
| 481 |
-
///
|
| 482 |
-
|
| 483 |
-
pub verification_id: String,
|
| 484 |
-
/// The phone number the Radar SMS challenge was sent to.
|
| 485 |
-
///
|
| 486 |
-
|
| 487 |
-
pub phone_number: String,
|
| 488 |
/// The pending authentication token from a previous authentication attempt.
|
| 489 |
///
|
| 490 |
/// Required.
|
|
@@ -504,14 +502,12 @@ impl AuthenticateWithRadarSmsChallengeParams {
|
|
| 504 |
/// Construct a new `AuthenticateWithRadarSmsChallengeParams` with the required fields set.
|
| 505 |
pub fn new(
|
| 506 |
code: impl Into<String>,
|
| 507 |
-
verification_id: impl Into<String>,
|
| 508 |
-
phone_number: impl Into<String>,
|
| 509 |
pending_authentication_token: impl Into<crate::SecretString>,
|
| 510 |
) -> Self {
|
| 511 |
Self {
|
| 512 |
code: code.into(),
|
| 513 |
-
verification_id:
|
| 514 |
-
phone_number:
|
| 515 |
pending_authentication_token: pending_authentication_token.into(),
|
| 516 |
ip_address: Default::default(),
|
| 517 |
device_id: Default::default(),
|
|
|
|
| 477 |
///
|
| 478 |
/// Required.
|
| 479 |
pub code: String,
|
| 480 |
+
/// The ID of the Radar SMS verification being confirmed. Required for sign-up challenges; omitted for sign-in challenges, where the verification is resolved server-side.
|
|
|
|
| 481 |
+
#[serde(skip_serializing_if = "Option::is_none")]
|
| 482 |
+
pub verification_id: Option<String>,
|
| 483 |
+
/// The phone number the Radar SMS challenge was sent to. Required for sign-up challenges; omitted for sign-in challenges, where the phone number on file is resolved server-side.
|
|
|
|
| 484 |
+
#[serde(skip_serializing_if = "Option::is_none")]
|
| 485 |
+
pub phone_number: Option<String>,
|
| 486 |
/// The pending authentication token from a previous authentication attempt.
|
| 487 |
///
|
| 488 |
/// Required.
|
|
|
|
| 502 |
/// Construct a new `AuthenticateWithRadarSmsChallengeParams` with the required fields set.
|
| 503 |
pub fn new(
|
| 504 |
code: impl Into<String>,
|
|
|
|
|
|
|
| 505 |
pending_authentication_token: impl Into<crate::SecretString>,
|
| 506 |
) -> Self {
|
| 507 |
Self {
|
| 508 |
code: code.into(),
|
| 509 |
+
verification_id: Default::default(),
|
| 510 |
+
phone_number: Default::default(),
|
| 511 |
pending_authentication_token: pending_authentication_token.into(),
|
| 512 |
ip_address: Default::default(),
|
| 513 |
device_id: Default::default(),
|
rust/tests/fixtures/agent_registration_refreshed.json|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"object": "event",
|
| 3 |
+
"id": "event_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 4 |
+
"event": "agent.registration.refreshed",
|
| 5 |
+
"data": {
|
| 6 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 7 |
+
},
|
| 8 |
+
"created_at": "2026-01-15T12:00:00.000Z"
|
| 9 |
+
}
|
rust/tests/fixtures/agent_registration_refreshed_data.json|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY"
|
| 3 |
+
}
|
rust/tests/fixtures/custom_provider_definition.json|
@@ -1,5 +1,3 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "My OAuth App"
|
| 3 |
-
"authorization_url": "https://provider.example.com/oauth/authorize",
|
| 4 |
-
"token_url": "https://provider.example.com/oauth/token"
|
| 5 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "My OAuth App"
|
|
|
|
|
|
|
| 3 |
}
|
rust/tests/fixtures/data_integrations_upsert_client_credentials_request.json|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
|
| 3 |
+
"client_id": "3MVG9...",
|
| 4 |
+
"client_secret": "shhh-secret"
|
| 5 |
+
}
|
rust/tests/fixtures/radar_sms_challenge_code_session_authenticate_request.json|
@@ -3,7 +3,5 @@
|
|
| 3 |
"client_secret": "sk_test_....",
|
| 4 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 5 |
"code": "123456",
|
| 6 |
-
"verification_id": "vrf_01HXYZ123456789ABCDEFGHIJ",
|
| 7 |
-
"phone_number": "+15555550123",
|
| 8 |
"pending_authentication_token": "cTDQJTTkTkkVYxbn..."
|
| 9 |
}
|
|
|
|
| 3 |
"client_secret": "sk_test_....",
|
| 4 |
"grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code",
|
| 5 |
"code": "123456",
|
|
|
|
|
|
|
| 6 |
"pending_authentication_token": "cTDQJTTkTkkVYxbn..."
|
| 7 |
}
|
rust/tests/pipes_test.rs|
@@ -1222,6 +1222,238 @@ async fn pipes_authorize_data_integration_unprocessable() {
|
|
| 1222 |
assert_eq!(api.status, 422);
|
| 1223 |
}
|
| 1224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1225 |
#[tokio::test]
|
| 1226 |
async fn pipes_create_data_integration_credential_round_trip() {
|
| 1227 |
let server = MockServer::start().await;
|
|
|
|
| 1222 |
assert_eq!(api.status, 422);
|
| 1223 |
}
|
| 1224 |
|
| 1225 |
+
#[tokio::test]
|
| 1226 |
+
async fn pipes_update_data_integration_client_credentials_round_trip() {
|
| 1227 |
+
let server = MockServer::start().await;
|
| 1228 |
+
Mock::given(method("PUT"))
|
| 1229 |
+
.and(path_matcher(
|
| 1230 |
+
"/data-integrations/test_id/client-credentials",
|
| 1231 |
+
))
|
| 1232 |
+
.respond_with(
|
| 1233 |
+
ResponseTemplate::new(200)
|
| 1234 |
+
.set_body_string(include_str!("fixtures/connected_account.json")),
|
| 1235 |
+
)
|
| 1236 |
+
.expect(1)
|
| 1237 |
+
.mount(&server)
|
| 1238 |
+
.await;
|
| 1239 |
+
let client = common::test_client(&server).await;
|
| 1240 |
+
let _ = client
|
| 1241 |
+
.pipes()
|
| 1242 |
+
.update_data_integration_client_credentials(
|
| 1243 |
+
"test_id",
|
| 1244 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1245 |
+
serde_json::from_str(include_str!(
|
| 1246 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1247 |
+
))
|
| 1248 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1249 |
+
),
|
| 1250 |
+
)
|
| 1251 |
+
.await;
|
| 1252 |
+
}
|
| 1253 |
+
|
| 1254 |
+
#[tokio::test]
|
| 1255 |
+
async fn pipes_update_data_integration_client_credentials_unauthorized() {
|
| 1256 |
+
let server = MockServer::start().await;
|
| 1257 |
+
let template = ResponseTemplate::new(401).set_body_string("{\"message\":\"Unauthorized\"}");
|
| 1258 |
+
Mock::given(method("PUT"))
|
| 1259 |
+
.and(path_matcher(
|
| 1260 |
+
"/data-integrations/test_id/client-credentials",
|
| 1261 |
+
))
|
| 1262 |
+
.respond_with(template)
|
| 1263 |
+
.expect(1)
|
| 1264 |
+
.mount(&server)
|
| 1265 |
+
.await;
|
| 1266 |
+
let client = common::test_client(&server).await;
|
| 1267 |
+
let err = client
|
| 1268 |
+
.pipes()
|
| 1269 |
+
.update_data_integration_client_credentials(
|
| 1270 |
+
"test_id",
|
| 1271 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1272 |
+
serde_json::from_str(include_str!(
|
| 1273 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1274 |
+
))
|
| 1275 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1276 |
+
),
|
| 1277 |
+
)
|
| 1278 |
+
.await
|
| 1279 |
+
.expect_err("expected error");
|
| 1280 |
+
let api = match &err {
|
| 1281 |
+
Error::Api(api) => api.as_ref(),
|
| 1282 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1283 |
+
};
|
| 1284 |
+
assert_eq!(api.status, 401);
|
| 1285 |
+
}
|
| 1286 |
+
|
| 1287 |
+
#[tokio::test]
|
| 1288 |
+
async fn pipes_update_data_integration_client_credentials_not_found() {
|
| 1289 |
+
let server = MockServer::start().await;
|
| 1290 |
+
let template = ResponseTemplate::new(404).set_body_string("{\"message\":\"Not found\"}");
|
| 1291 |
+
Mock::given(method("PUT"))
|
| 1292 |
+
.and(path_matcher(
|
| 1293 |
+
"/data-integrations/test_id/client-credentials",
|
| 1294 |
+
))
|
| 1295 |
+
.respond_with(template)
|
| 1296 |
+
.expect(1)
|
| 1297 |
+
.mount(&server)
|
| 1298 |
+
.await;
|
| 1299 |
+
let client = common::test_client(&server).await;
|
| 1300 |
+
let err = client
|
| 1301 |
+
.pipes()
|
| 1302 |
+
.update_data_integration_client_credentials(
|
| 1303 |
+
"test_id",
|
| 1304 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1305 |
+
serde_json::from_str(include_str!(
|
| 1306 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1307 |
+
))
|
| 1308 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1309 |
+
),
|
| 1310 |
+
)
|
| 1311 |
+
.await
|
| 1312 |
+
.expect_err("expected error");
|
| 1313 |
+
let api = match &err {
|
| 1314 |
+
Error::Api(api) => api.as_ref(),
|
| 1315 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1316 |
+
};
|
| 1317 |
+
assert_eq!(api.status, 404);
|
| 1318 |
+
}
|
| 1319 |
+
|
| 1320 |
+
#[tokio::test]
|
| 1321 |
+
async fn pipes_update_data_integration_client_credentials_rate_limited() {
|
| 1322 |
+
let server = MockServer::start().await;
|
| 1323 |
+
let template = ResponseTemplate::new(429)
|
| 1324 |
+
.insert_header("retry-after", "1")
|
| 1325 |
+
.set_body_string("{\"message\":\"Slow down\"}");
|
| 1326 |
+
Mock::given(method("PUT"))
|
| 1327 |
+
.and(path_matcher(
|
| 1328 |
+
"/data-integrations/test_id/client-credentials",
|
| 1329 |
+
))
|
| 1330 |
+
.respond_with(template)
|
| 1331 |
+
.expect(1)
|
| 1332 |
+
.mount(&server)
|
| 1333 |
+
.await;
|
| 1334 |
+
let client = common::test_client(&server).await;
|
| 1335 |
+
let err = client
|
| 1336 |
+
.pipes()
|
| 1337 |
+
.update_data_integration_client_credentials(
|
| 1338 |
+
"test_id",
|
| 1339 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1340 |
+
serde_json::from_str(include_str!(
|
| 1341 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1342 |
+
))
|
| 1343 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1344 |
+
),
|
| 1345 |
+
)
|
| 1346 |
+
.await
|
| 1347 |
+
.expect_err("expected error");
|
| 1348 |
+
let api = match &err {
|
| 1349 |
+
Error::Api(api) => api.as_ref(),
|
| 1350 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1351 |
+
};
|
| 1352 |
+
assert_eq!(api.status, 429);
|
| 1353 |
+
assert_eq!(api.retry_after, Some(std::time::Duration::from_secs(1)));
|
| 1354 |
+
}
|
| 1355 |
+
|
| 1356 |
+
#[tokio::test]
|
| 1357 |
+
async fn pipes_update_data_integration_client_credentials_server_error() {
|
| 1358 |
+
let server = MockServer::start().await;
|
| 1359 |
+
let template = ResponseTemplate::new(500).set_body_string("{\"message\":\"Internal error\"}");
|
| 1360 |
+
Mock::given(method("PUT"))
|
| 1361 |
+
.and(path_matcher(
|
| 1362 |
+
"/data-integrations/test_id/client-credentials",
|
| 1363 |
+
))
|
| 1364 |
+
.respond_with(template)
|
| 1365 |
+
.expect(1)
|
| 1366 |
+
.mount(&server)
|
| 1367 |
+
.await;
|
| 1368 |
+
let client = common::test_client(&server).await;
|
| 1369 |
+
let err = client
|
| 1370 |
+
.pipes()
|
| 1371 |
+
.update_data_integration_client_credentials(
|
| 1372 |
+
"test_id",
|
| 1373 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1374 |
+
serde_json::from_str(include_str!(
|
| 1375 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1376 |
+
))
|
| 1377 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1378 |
+
),
|
| 1379 |
+
)
|
| 1380 |
+
.await
|
| 1381 |
+
.expect_err("expected error");
|
| 1382 |
+
let api = match &err {
|
| 1383 |
+
Error::Api(api) => api.as_ref(),
|
| 1384 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1385 |
+
};
|
| 1386 |
+
assert_eq!(api.status, 500);
|
| 1387 |
+
}
|
| 1388 |
+
|
| 1389 |
+
#[tokio::test]
|
| 1390 |
+
async fn pipes_update_data_integration_client_credentials_bad_request() {
|
| 1391 |
+
let server = MockServer::start().await;
|
| 1392 |
+
let template = ResponseTemplate::new(400)
|
| 1393 |
+
.set_body_string("{\"code\":\"validation_error\",\"message\":\"Bad request\"}");
|
| 1394 |
+
Mock::given(method("PUT"))
|
| 1395 |
+
.and(path_matcher(
|
| 1396 |
+
"/data-integrations/test_id/client-credentials",
|
| 1397 |
+
))
|
| 1398 |
+
.respond_with(template)
|
| 1399 |
+
.expect(1)
|
| 1400 |
+
.mount(&server)
|
| 1401 |
+
.await;
|
| 1402 |
+
let client = common::test_client(&server).await;
|
| 1403 |
+
let err = client
|
| 1404 |
+
.pipes()
|
| 1405 |
+
.update_data_integration_client_credentials(
|
| 1406 |
+
"test_id",
|
| 1407 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1408 |
+
serde_json::from_str(include_str!(
|
| 1409 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1410 |
+
))
|
| 1411 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1412 |
+
),
|
| 1413 |
+
)
|
| 1414 |
+
.await
|
| 1415 |
+
.expect_err("expected error");
|
| 1416 |
+
let api = match &err {
|
| 1417 |
+
Error::Api(api) => api.as_ref(),
|
| 1418 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1419 |
+
};
|
| 1420 |
+
assert_eq!(api.status, 400);
|
| 1421 |
+
assert_eq!(api.code.as_deref(), Some("validation_error"));
|
| 1422 |
+
}
|
| 1423 |
+
|
| 1424 |
+
#[tokio::test]
|
| 1425 |
+
async fn pipes_update_data_integration_client_credentials_unprocessable() {
|
| 1426 |
+
let server = MockServer::start().await;
|
| 1427 |
+
let template = ResponseTemplate::new(422).set_body_string("{\"message\":\"Unprocessable\"}");
|
| 1428 |
+
Mock::given(method("PUT"))
|
| 1429 |
+
.and(path_matcher(
|
| 1430 |
+
"/data-integrations/test_id/client-credentials",
|
| 1431 |
+
))
|
| 1432 |
+
.respond_with(template)
|
| 1433 |
+
.expect(1)
|
| 1434 |
+
.mount(&server)
|
| 1435 |
+
.await;
|
| 1436 |
+
let client = common::test_client(&server).await;
|
| 1437 |
+
let err = client
|
| 1438 |
+
.pipes()
|
| 1439 |
+
.update_data_integration_client_credentials(
|
| 1440 |
+
"test_id",
|
| 1441 |
+
workos::pipes::UpdateDataIntegrationClientCredentialsParams::new(
|
| 1442 |
+
serde_json::from_str(include_str!(
|
| 1443 |
+
"fixtures/data_integrations_upsert_client_credentials_request.json"
|
| 1444 |
+
))
|
| 1445 |
+
.expect("parse fixture for DataIntegrationsUpsertClientCredentialsRequest"),
|
| 1446 |
+
),
|
| 1447 |
+
)
|
| 1448 |
+
.await
|
| 1449 |
+
.expect_err("expected error");
|
| 1450 |
+
let api = match &err {
|
| 1451 |
+
Error::Api(api) => api.as_ref(),
|
| 1452 |
+
other => panic!("expected Error::Api, got {other:?}"),
|
| 1453 |
+
};
|
| 1454 |
+
assert_eq!(api.status, 422);
|
| 1455 |
+
}
|
| 1456 |
+
|
| 1457 |
#[tokio::test]
|
| 1458 |
async fn pipes_create_data_integration_credential_round_trip() {
|
| 1459 |
let server = MockServer::start().await;
|
rust/tests/user_management_test.rs|
@@ -1872,8 +1872,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_round_trip() {
|
|
| 1872 |
.authenticate_with_radar_sms_challenge(
|
| 1873 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1874 |
"stub_code".to_string(),
|
| 1875 |
-
"stub_verification_id".to_string(),
|
| 1876 |
-
"stub_phone_number".to_string(),
|
| 1877 |
"stub_pending_authentication_token".to_string(),
|
| 1878 |
),
|
| 1879 |
)
|
|
@@ -1896,8 +1894,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_unauthorized() {
|
|
| 1896 |
.authenticate_with_radar_sms_challenge(
|
| 1897 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1898 |
"stub_code".to_string(),
|
| 1899 |
-
"stub_verification_id".to_string(),
|
| 1900 |
-
"stub_phone_number".to_string(),
|
| 1901 |
"stub_pending_authentication_token".to_string(),
|
| 1902 |
),
|
| 1903 |
)
|
|
@@ -1926,8 +1922,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_not_found() {
|
|
| 1926 |
.authenticate_with_radar_sms_challenge(
|
| 1927 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1928 |
"stub_code".to_string(),
|
| 1929 |
-
"stub_verification_id".to_string(),
|
| 1930 |
-
"stub_phone_number".to_string(),
|
| 1931 |
"stub_pending_authentication_token".to_string(),
|
| 1932 |
),
|
| 1933 |
)
|
|
@@ -1958,8 +1952,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_rate_limited() {
|
|
| 1958 |
.authenticate_with_radar_sms_challenge(
|
| 1959 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1960 |
"stub_code".to_string(),
|
| 1961 |
-
"stub_verification_id".to_string(),
|
| 1962 |
-
"stub_phone_number".to_string(),
|
| 1963 |
"stub_pending_authentication_token".to_string(),
|
| 1964 |
),
|
| 1965 |
)
|
|
@@ -1989,8 +1981,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_server_error() {
|
|
| 1989 |
.authenticate_with_radar_sms_challenge(
|
| 1990 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1991 |
"stub_code".to_string(),
|
| 1992 |
-
"stub_verification_id".to_string(),
|
| 1993 |
-
"stub_phone_number".to_string(),
|
| 1994 |
"stub_pending_authentication_token".to_string(),
|
| 1995 |
),
|
| 1996 |
)
|
|
@@ -2020,8 +2010,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_bad_request() {
|
|
| 2020 |
.authenticate_with_radar_sms_challenge(
|
| 2021 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 2022 |
"stub_code".to_string(),
|
| 2023 |
-
"stub_verification_id".to_string(),
|
| 2024 |
-
"stub_phone_number".to_string(),
|
| 2025 |
"stub_pending_authentication_token".to_string(),
|
| 2026 |
),
|
| 2027 |
)
|
|
@@ -2051,8 +2039,6 @@ async fn user_management_authenticate_with_radar_sms_challenge_unprocessable() {
|
|
| 2051 |
.authenticate_with_radar_sms_challenge(
|
| 2052 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 2053 |
"stub_code".to_string(),
|
| 2054 |
-
"stub_verification_id".to_string(),
|
| 2055 |
-
"stub_phone_number".to_string(),
|
| 2056 |
"stub_pending_authentication_token".to_string(),
|
| 2057 |
),
|
| 2058 |
)
|
|
|
|
| 1872 |
.authenticate_with_radar_sms_challenge(
|
| 1873 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1874 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 1875 |
"stub_pending_authentication_token".to_string(),
|
| 1876 |
),
|
| 1877 |
)
|
|
|
|
| 1894 |
.authenticate_with_radar_sms_challenge(
|
| 1895 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1896 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 1897 |
"stub_pending_authentication_token".to_string(),
|
| 1898 |
),
|
| 1899 |
)
|
|
|
|
| 1922 |
.authenticate_with_radar_sms_challenge(
|
| 1923 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1924 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 1925 |
"stub_pending_authentication_token".to_string(),
|
| 1926 |
),
|
| 1927 |
)
|
|
|
|
| 1952 |
.authenticate_with_radar_sms_challenge(
|
| 1953 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1954 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 1955 |
"stub_pending_authentication_token".to_string(),
|
| 1956 |
),
|
| 1957 |
)
|
|
|
|
| 1981 |
.authenticate_with_radar_sms_challenge(
|
| 1982 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 1983 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 1984 |
"stub_pending_authentication_token".to_string(),
|
| 1985 |
),
|
| 1986 |
)
|
|
|
|
| 2010 |
.authenticate_with_radar_sms_challenge(
|
| 2011 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 2012 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 2013 |
"stub_pending_authentication_token".to_string(),
|
| 2014 |
),
|
| 2015 |
)
|
|
|
|
| 2039 |
.authenticate_with_radar_sms_challenge(
|
| 2040 |
workos::user_management::AuthenticateWithRadarSmsChallengeParams::new(
|
| 2041 |
"stub_code".to_string(),
|
|
|
|
|
|
|
| 2042 |
"stub_pending_authentication_token".to_string(),
|
| 2043 |
),
|
| 2044 |
)
|
All files in this language are hidden by the current filters.