workos 3.4.1

Official Rust SDK for the WorkOS API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
// This file is auto-generated by oagen. Do not edit.

use serde::{Deserialize, Serialize};
use std::fmt;
use std::str::FromStr;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum UpdateWebhookEndpointEvents {
    AgentBlueprintCreated,
    AgentBlueprintDeleted,
    AgentBlueprintUpdated,
    AgentInstanceCreated,
    AgentInstanceDeleted,
    AgentInstanceSessionCreated,
    AgentInstanceSessionRevoked,
    AgentRegistrationCreated,
    AgentRegistrationClaimAttemptCreated,
    AgentRegistrationClaimCompleted,
    AgentRegistrationCredentialIssued,
    AgentRegistrationDeleted,
    AgentRegistrationRefreshed,
    AgentRegistrationExpired,
    AgentRegistrationOrganizationSwitched,
    AgentRegistrationRevoked,
    AuthenticationEmailVerificationSucceeded,
    AuthenticationMagicAuthFailed,
    AuthenticationMagicAuthSucceeded,
    AuthenticationMfaSucceeded,
    AuthenticationOAuthFailed,
    AuthenticationOAuthSucceeded,
    AuthenticationPasswordFailed,
    AuthenticationPasswordSucceeded,
    AuthenticationPasskeyFailed,
    AuthenticationPasskeySucceeded,
    AuthenticationSSOFailed,
    AuthenticationSSOStarted,
    AuthenticationSSOSucceeded,
    AuthenticationSSOTimedOut,
    RadarChallengeCreated,
    AuthenticationRadarRiskDetected,
    AuthenticationReauthenticationSucceeded,
    ApiKeyCreated,
    ApiKeyRevoked,
    ApiKeyUpdated,
    ConnectionActivated,
    ConnectionDeactivated,
    ConnectionSAMLCertificateRenewalRequired,
    ConnectionSAMLCertificateRenewed,
    ConnectionDeleted,
    DsyncActivated,
    DsyncDeleted,
    DsyncGroupCreated,
    DsyncGroupDeleted,
    DsyncGroupUpdated,
    DsyncGroupUserAdded,
    DsyncGroupUserRemoved,
    DsyncUserCreated,
    DsyncUserDeleted,
    DsyncUserUpdated,
    EmailVerificationCreated,
    GroupCreated,
    GroupDeleted,
    GroupMemberAdded,
    GroupMemberRemoved,
    GroupUpdated,
    FlagCreated,
    FlagDeleted,
    FlagUpdated,
    FlagRuleUpdated,
    InvitationAccepted,
    InvitationCreated,
    InvitationResent,
    InvitationRevoked,
    MagicAuthCreated,
    OrganizationCreated,
    OrganizationDeleted,
    OrganizationUpdated,
    OrganizationDomainCreated,
    OrganizationDomainDeleted,
    OrganizationDomainUpdated,
    OrganizationDomainVerified,
    OrganizationDomainVerificationFailed,
    PasswordResetCreated,
    PasswordResetSucceeded,
    UserCreated,
    UserUpdated,
    UserDeleted,
    OrganizationMembershipCreated,
    OrganizationMembershipDeleted,
    OrganizationMembershipUpdated,
    RoleCreated,
    RoleDeleted,
    RoleUpdated,
    OrganizationRoleCreated,
    OrganizationRoleDeleted,
    OrganizationRoleUpdated,
    PermissionCreated,
    PermissionDeleted,
    PermissionUpdated,
    PipesAccountConnectionAddFailed,
    PipesAccountConnectionConnected,
    PipesAccountConnectionConnectionFailed,
    PipesAccountConnectionDisconnected,
    PipesAccountConnectionReauthorizationNeeded,
    PipesConnectedAccountConnected,
    PipesConnectedAccountConnectionFailed,
    PipesConnectedAccountDisconnected,
    PipesConnectedAccountReauthorizationNeeded,
    SessionCreated,
    SessionRevoked,
    WaitlistUserApproved,
    WaitlistUserCreated,
    WaitlistUserDenied,
    /// Wire value not recognized by this SDK version. The original
    /// string is preserved verbatim. WorkOS may add new enum values
    /// server-side; matching on this variant lets callers handle
    /// forward-compatible values without panicking.
    Unknown(String),
}

impl UpdateWebhookEndpointEvents {
    /// Canonical wire string for this value. For [`Self::Unknown`] returns the
    /// original wire value as received from the API.
    #[allow(deprecated)]
    pub fn as_str(&self) -> &str {
        match self {
            Self::AgentBlueprintCreated => "agent.blueprint.created",
            Self::AgentBlueprintDeleted => "agent.blueprint.deleted",
            Self::AgentBlueprintUpdated => "agent.blueprint.updated",
            Self::AgentInstanceCreated => "agent.instance.created",
            Self::AgentInstanceDeleted => "agent.instance.deleted",
            Self::AgentInstanceSessionCreated => "agent.instance.session.created",
            Self::AgentInstanceSessionRevoked => "agent.instance.session.revoked",
            Self::AgentRegistrationCreated => "agent.registration.created",
            Self::AgentRegistrationClaimAttemptCreated => {
                "agent.registration.claim.attempt.created"
            }
            Self::AgentRegistrationClaimCompleted => "agent.registration.claim.completed",
            Self::AgentRegistrationCredentialIssued => "agent.registration.credential.issued",
            Self::AgentRegistrationDeleted => "agent.registration.deleted",
            Self::AgentRegistrationRefreshed => "agent.registration.refreshed",
            Self::AgentRegistrationExpired => "agent.registration.expired",
            Self::AgentRegistrationOrganizationSwitched => {
                "agent.registration.organization.switched"
            }
            Self::AgentRegistrationRevoked => "agent.registration.revoked",
            Self::AuthenticationEmailVerificationSucceeded => {
                "authentication.email_verification_succeeded"
            }
            Self::AuthenticationMagicAuthFailed => "authentication.magic_auth_failed",
            Self::AuthenticationMagicAuthSucceeded => "authentication.magic_auth_succeeded",
            Self::AuthenticationMfaSucceeded => "authentication.mfa_succeeded",
            Self::AuthenticationOAuthFailed => "authentication.oauth_failed",
            Self::AuthenticationOAuthSucceeded => "authentication.oauth_succeeded",
            Self::AuthenticationPasswordFailed => "authentication.password_failed",
            Self::AuthenticationPasswordSucceeded => "authentication.password_succeeded",
            Self::AuthenticationPasskeyFailed => "authentication.passkey_failed",
            Self::AuthenticationPasskeySucceeded => "authentication.passkey_succeeded",
            Self::AuthenticationSSOFailed => "authentication.sso_failed",
            Self::AuthenticationSSOStarted => "authentication.sso_started",
            Self::AuthenticationSSOSucceeded => "authentication.sso_succeeded",
            Self::AuthenticationSSOTimedOut => "authentication.sso_timed_out",
            Self::RadarChallengeCreated => "radar.challenge_created",
            Self::AuthenticationRadarRiskDetected => "authentication.radar_risk_detected",
            Self::AuthenticationReauthenticationSucceeded => {
                "authentication.reauthentication_succeeded"
            }
            Self::ApiKeyCreated => "api_key.created",
            Self::ApiKeyRevoked => "api_key.revoked",
            Self::ApiKeyUpdated => "api_key.updated",
            Self::ConnectionActivated => "connection.activated",
            Self::ConnectionDeactivated => "connection.deactivated",
            Self::ConnectionSAMLCertificateRenewalRequired => {
                "connection.saml_certificate_renewal_required"
            }
            Self::ConnectionSAMLCertificateRenewed => "connection.saml_certificate_renewed",
            Self::ConnectionDeleted => "connection.deleted",
            Self::DsyncActivated => "dsync.activated",
            Self::DsyncDeleted => "dsync.deleted",
            Self::DsyncGroupCreated => "dsync.group.created",
            Self::DsyncGroupDeleted => "dsync.group.deleted",
            Self::DsyncGroupUpdated => "dsync.group.updated",
            Self::DsyncGroupUserAdded => "dsync.group.user_added",
            Self::DsyncGroupUserRemoved => "dsync.group.user_removed",
            Self::DsyncUserCreated => "dsync.user.created",
            Self::DsyncUserDeleted => "dsync.user.deleted",
            Self::DsyncUserUpdated => "dsync.user.updated",
            Self::EmailVerificationCreated => "email_verification.created",
            Self::GroupCreated => "group.created",
            Self::GroupDeleted => "group.deleted",
            Self::GroupMemberAdded => "group.member_added",
            Self::GroupMemberRemoved => "group.member_removed",
            Self::GroupUpdated => "group.updated",
            Self::FlagCreated => "flag.created",
            Self::FlagDeleted => "flag.deleted",
            Self::FlagUpdated => "flag.updated",
            Self::FlagRuleUpdated => "flag.rule_updated",
            Self::InvitationAccepted => "invitation.accepted",
            Self::InvitationCreated => "invitation.created",
            Self::InvitationResent => "invitation.resent",
            Self::InvitationRevoked => "invitation.revoked",
            Self::MagicAuthCreated => "magic_auth.created",
            Self::OrganizationCreated => "organization.created",
            Self::OrganizationDeleted => "organization.deleted",
            Self::OrganizationUpdated => "organization.updated",
            Self::OrganizationDomainCreated => "organization_domain.created",
            Self::OrganizationDomainDeleted => "organization_domain.deleted",
            Self::OrganizationDomainUpdated => "organization_domain.updated",
            Self::OrganizationDomainVerified => "organization_domain.verified",
            Self::OrganizationDomainVerificationFailed => "organization_domain.verification_failed",
            Self::PasswordResetCreated => "password_reset.created",
            Self::PasswordResetSucceeded => "password_reset.succeeded",
            Self::UserCreated => "user.created",
            Self::UserUpdated => "user.updated",
            Self::UserDeleted => "user.deleted",
            Self::OrganizationMembershipCreated => "organization_membership.created",
            Self::OrganizationMembershipDeleted => "organization_membership.deleted",
            Self::OrganizationMembershipUpdated => "organization_membership.updated",
            Self::RoleCreated => "role.created",
            Self::RoleDeleted => "role.deleted",
            Self::RoleUpdated => "role.updated",
            Self::OrganizationRoleCreated => "organization_role.created",
            Self::OrganizationRoleDeleted => "organization_role.deleted",
            Self::OrganizationRoleUpdated => "organization_role.updated",
            Self::PermissionCreated => "permission.created",
            Self::PermissionDeleted => "permission.deleted",
            Self::PermissionUpdated => "permission.updated",
            Self::PipesAccountConnectionAddFailed => "pipes.account_connection.add_failed",
            Self::PipesAccountConnectionConnected => "pipes.account_connection.connected",
            Self::PipesAccountConnectionConnectionFailed => {
                "pipes.account_connection.connection_failed"
            }
            Self::PipesAccountConnectionDisconnected => "pipes.account_connection.disconnected",
            Self::PipesAccountConnectionReauthorizationNeeded => {
                "pipes.account_connection.reauthorization_needed"
            }
            Self::PipesConnectedAccountConnected => "pipes.connected_account.connected",
            Self::PipesConnectedAccountConnectionFailed => {
                "pipes.connected_account.connection_failed"
            }
            Self::PipesConnectedAccountDisconnected => "pipes.connected_account.disconnected",
            Self::PipesConnectedAccountReauthorizationNeeded => {
                "pipes.connected_account.reauthorization_needed"
            }
            Self::SessionCreated => "session.created",
            Self::SessionRevoked => "session.revoked",
            Self::WaitlistUserApproved => "waitlist_user.approved",
            Self::WaitlistUserCreated => "waitlist_user.created",
            Self::WaitlistUserDenied => "waitlist_user.denied",
            Self::Unknown(s) => s.as_str(),
        }
    }
}

impl fmt::Display for UpdateWebhookEndpointEvents {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.as_str())
    }
}

impl AsRef<str> for UpdateWebhookEndpointEvents {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl FromStr for UpdateWebhookEndpointEvents {
    type Err = std::convert::Infallible;
    #[allow(deprecated)]
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(match s {
            "agent.blueprint.created" => Self::AgentBlueprintCreated,
            "agent.blueprint.deleted" => Self::AgentBlueprintDeleted,
            "agent.blueprint.updated" => Self::AgentBlueprintUpdated,
            "agent.instance.created" => Self::AgentInstanceCreated,
            "agent.instance.deleted" => Self::AgentInstanceDeleted,
            "agent.instance.session.created" => Self::AgentInstanceSessionCreated,
            "agent.instance.session.revoked" => Self::AgentInstanceSessionRevoked,
            "agent.registration.created" => Self::AgentRegistrationCreated,
            "agent.registration.claim.attempt.created" => {
                Self::AgentRegistrationClaimAttemptCreated
            }
            "agent.registration.claim.completed" => Self::AgentRegistrationClaimCompleted,
            "agent.registration.credential.issued" => Self::AgentRegistrationCredentialIssued,
            "agent.registration.deleted" => Self::AgentRegistrationDeleted,
            "agent.registration.refreshed" => Self::AgentRegistrationRefreshed,
            "agent.registration.expired" => Self::AgentRegistrationExpired,
            "agent.registration.organization.switched" => {
                Self::AgentRegistrationOrganizationSwitched
            }
            "agent.registration.revoked" => Self::AgentRegistrationRevoked,
            "authentication.email_verification_succeeded" => {
                Self::AuthenticationEmailVerificationSucceeded
            }
            "authentication.magic_auth_failed" => Self::AuthenticationMagicAuthFailed,
            "authentication.magic_auth_succeeded" => Self::AuthenticationMagicAuthSucceeded,
            "authentication.mfa_succeeded" => Self::AuthenticationMfaSucceeded,
            "authentication.oauth_failed" => Self::AuthenticationOAuthFailed,
            "authentication.oauth_succeeded" => Self::AuthenticationOAuthSucceeded,
            "authentication.password_failed" => Self::AuthenticationPasswordFailed,
            "authentication.password_succeeded" => Self::AuthenticationPasswordSucceeded,
            "authentication.passkey_failed" => Self::AuthenticationPasskeyFailed,
            "authentication.passkey_succeeded" => Self::AuthenticationPasskeySucceeded,
            "authentication.sso_failed" => Self::AuthenticationSSOFailed,
            "authentication.sso_started" => Self::AuthenticationSSOStarted,
            "authentication.sso_succeeded" => Self::AuthenticationSSOSucceeded,
            "authentication.sso_timed_out" => Self::AuthenticationSSOTimedOut,
            "radar.challenge_created" => Self::RadarChallengeCreated,
            "authentication.radar_risk_detected" => Self::AuthenticationRadarRiskDetected,
            "authentication.reauthentication_succeeded" => {
                Self::AuthenticationReauthenticationSucceeded
            }
            "api_key.created" => Self::ApiKeyCreated,
            "api_key.revoked" => Self::ApiKeyRevoked,
            "api_key.updated" => Self::ApiKeyUpdated,
            "connection.activated" => Self::ConnectionActivated,
            "connection.deactivated" => Self::ConnectionDeactivated,
            "connection.saml_certificate_renewal_required" => {
                Self::ConnectionSAMLCertificateRenewalRequired
            }
            "connection.saml_certificate_renewed" => Self::ConnectionSAMLCertificateRenewed,
            "connection.deleted" => Self::ConnectionDeleted,
            "dsync.activated" => Self::DsyncActivated,
            "dsync.deleted" => Self::DsyncDeleted,
            "dsync.group.created" => Self::DsyncGroupCreated,
            "dsync.group.deleted" => Self::DsyncGroupDeleted,
            "dsync.group.updated" => Self::DsyncGroupUpdated,
            "dsync.group.user_added" => Self::DsyncGroupUserAdded,
            "dsync.group.user_removed" => Self::DsyncGroupUserRemoved,
            "dsync.user.created" => Self::DsyncUserCreated,
            "dsync.user.deleted" => Self::DsyncUserDeleted,
            "dsync.user.updated" => Self::DsyncUserUpdated,
            "email_verification.created" => Self::EmailVerificationCreated,
            "group.created" => Self::GroupCreated,
            "group.deleted" => Self::GroupDeleted,
            "group.member_added" => Self::GroupMemberAdded,
            "group.member_removed" => Self::GroupMemberRemoved,
            "group.updated" => Self::GroupUpdated,
            "flag.created" => Self::FlagCreated,
            "flag.deleted" => Self::FlagDeleted,
            "flag.updated" => Self::FlagUpdated,
            "flag.rule_updated" => Self::FlagRuleUpdated,
            "invitation.accepted" => Self::InvitationAccepted,
            "invitation.created" => Self::InvitationCreated,
            "invitation.resent" => Self::InvitationResent,
            "invitation.revoked" => Self::InvitationRevoked,
            "magic_auth.created" => Self::MagicAuthCreated,
            "organization.created" => Self::OrganizationCreated,
            "organization.deleted" => Self::OrganizationDeleted,
            "organization.updated" => Self::OrganizationUpdated,
            "organization_domain.created" => Self::OrganizationDomainCreated,
            "organization_domain.deleted" => Self::OrganizationDomainDeleted,
            "organization_domain.updated" => Self::OrganizationDomainUpdated,
            "organization_domain.verified" => Self::OrganizationDomainVerified,
            "organization_domain.verification_failed" => Self::OrganizationDomainVerificationFailed,
            "password_reset.created" => Self::PasswordResetCreated,
            "password_reset.succeeded" => Self::PasswordResetSucceeded,
            "user.created" => Self::UserCreated,
            "user.updated" => Self::UserUpdated,
            "user.deleted" => Self::UserDeleted,
            "organization_membership.created" => Self::OrganizationMembershipCreated,
            "organization_membership.deleted" => Self::OrganizationMembershipDeleted,
            "organization_membership.updated" => Self::OrganizationMembershipUpdated,
            "role.created" => Self::RoleCreated,
            "role.deleted" => Self::RoleDeleted,
            "role.updated" => Self::RoleUpdated,
            "organization_role.created" => Self::OrganizationRoleCreated,
            "organization_role.deleted" => Self::OrganizationRoleDeleted,
            "organization_role.updated" => Self::OrganizationRoleUpdated,
            "permission.created" => Self::PermissionCreated,
            "permission.deleted" => Self::PermissionDeleted,
            "permission.updated" => Self::PermissionUpdated,
            "pipes.account_connection.add_failed" => Self::PipesAccountConnectionAddFailed,
            "pipes.account_connection.connected" => Self::PipesAccountConnectionConnected,
            "pipes.account_connection.connection_failed" => {
                Self::PipesAccountConnectionConnectionFailed
            }
            "pipes.account_connection.disconnected" => Self::PipesAccountConnectionDisconnected,
            "pipes.account_connection.reauthorization_needed" => {
                Self::PipesAccountConnectionReauthorizationNeeded
            }
            "pipes.connected_account.connected" => Self::PipesConnectedAccountConnected,
            "pipes.connected_account.connection_failed" => {
                Self::PipesConnectedAccountConnectionFailed
            }
            "pipes.connected_account.disconnected" => Self::PipesConnectedAccountDisconnected,
            "pipes.connected_account.reauthorization_needed" => {
                Self::PipesConnectedAccountReauthorizationNeeded
            }
            "session.created" => Self::SessionCreated,
            "session.revoked" => Self::SessionRevoked,
            "waitlist_user.approved" => Self::WaitlistUserApproved,
            "waitlist_user.created" => Self::WaitlistUserCreated,
            "waitlist_user.denied" => Self::WaitlistUserDenied,
            other => Self::Unknown(other.to_string()),
        })
    }
}

impl From<String> for UpdateWebhookEndpointEvents {
    fn from(s: String) -> Self {
        // Reuse the original `String` allocation in the fallback branch.
        match Self::from_str(&s) {
            Ok(Self::Unknown(_)) => Self::Unknown(s),
            Ok(other) => other,
        }
    }
}

impl From<&str> for UpdateWebhookEndpointEvents {
    fn from(s: &str) -> Self {
        Self::from_str(s).unwrap_or_else(|_| Self::Unknown(s.to_string()))
    }
}

impl Serialize for UpdateWebhookEndpointEvents {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de> Deserialize<'de> for UpdateWebhookEndpointEvents {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        let s = String::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}