Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains the response data from authenticating a user.
/// </summary>
public class AuthenticationResponse
{
/// <summary>
/// The authenticated <see cref="User"/>.
/// </summary>
[JsonProperty("user")]
public User User { get; set; }

/// <summary>
/// The organization ID associated with the user (optional).
/// </summary>
[JsonProperty("organization_id")]
public string OrganizationId { get; set; }

/// <summary>
/// The access token for the authenticated session.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// The refresh token for refreshing the access token.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }

/// <summary>
/// The authentication method used.
/// </summary>
[JsonProperty("authentication_method")]
public AuthenticationMethod AuthenticationMethod { get; set; }

/// <summary>
/// Information about the impersonator if the user was impersonated (optional).
/// </summary>
[JsonProperty("impersonator")]
public Impersonator Impersonator { get; set; }

/// <summary>
/// OAuth tokens returned by the authentication provider (optional).
/// </summary>
[JsonProperty("oauth_tokens")]
public OAuthTokens OAuthTokens { get; set; }
}
}
22 changes: 22 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/Impersonator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains information about a user who is impersonating another user.
/// </summary>
public class Impersonator
{
/// <summary>
/// The email address of the impersonator.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The reason for impersonation.
/// </summary>
[JsonProperty("reason")]
public string Reason { get; set; }
}
}
35 changes: 35 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/OAuthTokens.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace WorkOS
{
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains OAuth tokens returned by an external OAuth provider.
/// </summary>
public class OAuthTokens
{
/// <summary>
/// The access token from the OAuth provider.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// The refresh token from the OAuth provider.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }

/// <summary>
/// The timestamp at which the access token expires.
/// </summary>
[JsonProperty("expires_at")]
public int ExpiresAt { get; set; }

/// <summary>
/// The list of OAuth scopes for which the access token is authorized.
/// </summary>
[JsonProperty("scopes")]
public List<string> Scopes { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace WorkOS
{
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS Organization Membership record.
/// </summary>
public class OrganizationMembership
{
/// <summary>
/// Description of the record.
/// </summary>
[JsonProperty("object")]
public const string Object = "organization_membership";

/// <summary>
/// The organization membership's identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The user's identifier.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }

/// <summary>
/// The organization's identifier.
/// </summary>
[JsonProperty("organization_id")]
public string OrganizationId { get; set; }

/// <summary>
/// The organization's name.
/// </summary>
[JsonProperty("organization_name")]
public string OrganizationName { get; set; }

/// <summary>
/// The primary role assigned to the membership.
/// </summary>
[JsonProperty("role")]
public OrganizationMembershipRole Role { get; set; }

/// <summary>
/// List of roles assigned to the membership.
/// </summary>
[JsonProperty("roles")]
public List<OrganizationMembershipRole> Roles { get; set; }

/// <summary>
/// The status of the organization membership.
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }

/// <summary>
/// The timestamp of when the organization membership was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }

/// <summary>
/// The timestamp of when the organization membership was updated.
/// </summary>
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains information about a role in an organization membership.
/// </summary>
public class OrganizationMembershipRole
{
/// <summary>
/// The slug identifier of the role.
/// </summary>
[JsonProperty("slug")]
public string Slug { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace WorkOS
{
using System;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS Password Reset record.
/// </summary>
public class PasswordReset
{
/// <summary>
/// The Password Reset identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The User identifier associated with this password reset.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }

/// <summary>
/// The email address associated with this password reset.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The password reset token that can be used to reset the user's password.
/// </summary>
[JsonProperty("password_reset_token")]
public string PasswordResetToken { get; set; }

/// <summary>
/// The URL where the user can reset their password using the token.
/// </summary>
[JsonProperty("password_reset_url")]
public string PasswordResetUrl { get; set; }

/// <summary>
/// The timestamp when this password reset token expires.
/// </summary>
[JsonProperty("expires_at")]
public string ExpiresAt { get; set; }

/// <summary>
/// The timestamp of when the password reset was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
}
90 changes: 90 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
namespace WorkOS
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS User record.
/// </summary>
public class User
{
/// <summary>
/// Description of the record.
/// </summary>
[JsonProperty("object")]
public const string Object = "user";

/// <summary>
/// The User's identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The User's email address.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The User's first name.
/// </summary>
[JsonProperty("first_name")]
public string FirstName { get; set; }

/// <summary>
/// The User's last name.
/// </summary>
[JsonProperty("last_name")]
public string LastName { get; set; }

/// <summary>
/// Whether the User's email address has been verified.
/// </summary>
[JsonProperty("email_verified")]
public bool EmailVerified { get; set; }

/// <summary>
/// The User's profile picture URL.
/// </summary>
[JsonProperty("profile_picture_url")]
public string ProfilePictureUrl { get; set; }

/// <summary>
/// The timestamp of the User's last sign in.
/// </summary>
[JsonProperty("last_sign_in_at")]
public string LastSignInAt { get; set; }

/// <summary>
/// The User's external identifier.
/// </summary>
[JsonProperty("external_id")]
public string ExternalId { get; set; }

/// <summary>
/// The User's metadata.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

/// <summary>
/// The User's locale.
/// </summary>
[JsonProperty("locale")]
public string Locale { get; set; }

/// <summary>
/// The timestamp of when the User was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }

/// <summary>
/// The timestamp of when the User was updated.
/// </summary>
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace WorkOS
{
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

/// <summary>
/// An enum describing the authentication method used to authenticate a user.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum AuthenticationMethod
{
[EnumMember(Value = "SSO")]
SSO,

[EnumMember(Value = "Password")]
Password,

[EnumMember(Value = "AppleOAuth")]
AppleOAuth,

[EnumMember(Value = "GitHubOAuth")]
GitHubOAuth,

[EnumMember(Value = "GoogleOAuth")]
GoogleOAuth,

[EnumMember(Value = "MicrosoftOAuth")]
MicrosoftOAuth,

[EnumMember(Value = "MagicAuth")]
MagicAuth,

[EnumMember(Value = "Impersonation")]
Impersonation,
}
}
Loading