Documentation
¶
Overview ¶
Package signup provides user signup and personal organization creation.
Index ¶
- type AcceptInviteOnSignupInput
- type AcceptInviteOnSignupResult
- type DefaultService
- func (s *DefaultService) Signup(ctx context.Context, input SignupInput) (*SignupResult, error)
- func (s *DefaultService) SignupOrGetExisting(ctx context.Context, input SignupInput) (*SignupResult, bool, error)
- func (s *DefaultService) SignupWithInvite(ctx context.Context, input AcceptInviteOnSignupInput) (*AcceptInviteOnSignupResult, error)
- type Service
- type SignupInput
- type SignupResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptInviteOnSignupInput ¶
type AcceptInviteOnSignupInput struct {
// SignupInput contains the user's signup details.
SignupInput
// InviteToken is the invitation token to accept.
InviteToken string
}
AcceptInviteOnSignupInput contains input for signing up while accepting an invite.
type AcceptInviteOnSignupResult ¶
type AcceptInviteOnSignupResult struct {
// SignupResult contains the user and personal org.
SignupResult
// InvitedOrganizationID is the organization from the invite.
InvitedOrganizationID uuid.UUID
// InvitedRole is the role granted by the invite.
InvitedRole string
}
AcceptInviteOnSignupResult contains the result of signing up with an invite.
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
DefaultService implements the Service interface.
func (*DefaultService) Signup ¶
func (s *DefaultService) Signup(ctx context.Context, input SignupInput) (*SignupResult, error)
Signup creates a new user with their personal organization.
func (*DefaultService) SignupOrGetExisting ¶
func (s *DefaultService) SignupOrGetExisting(ctx context.Context, input SignupInput) (*SignupResult, bool, error)
SignupOrGetExisting handles OAuth login - gets existing user or creates new one.
func (*DefaultService) SignupWithInvite ¶
func (s *DefaultService) SignupWithInvite(ctx context.Context, input AcceptInviteOnSignupInput) (*AcceptInviteOnSignupResult, error)
SignupWithInvite creates a new user, their personal org, and accepts an invite.
type Service ¶
type Service interface {
// Signup creates a new user with their personal organization.
// This is the standard signup flow for new users.
Signup(ctx context.Context, input SignupInput) (*SignupResult, error)
// SignupWithInvite creates a new user, their personal org, and accepts an invite.
// This is used when a user signs up by accepting an invitation to an org.
SignupWithInvite(ctx context.Context, input AcceptInviteOnSignupInput) (*AcceptInviteOnSignupResult, error)
// SignupOrGetExisting handles the OAuth login flow:
// - If user exists, returns them and their personal org
// - If user doesn't exist, creates them with personal org
SignupOrGetExisting(ctx context.Context, input SignupInput) (*SignupResult, bool, error)
}
Service defines the signup service interface.
type SignupInput ¶
type SignupInput struct {
// Email is the user's email address (required).
Email string
// DisplayName is the user's display name (required).
DisplayName string
// GivenName is the user's first name (optional).
GivenName string
// FamilyName is the user's last name (optional).
FamilyName string
// AvatarURL is the user's avatar URL (optional, often from OAuth provider).
AvatarURL *string
// Locale is the user's preferred locale (optional).
Locale string
// Timezone is the user's preferred timezone (optional).
Timezone string
// PersonalOrgSlug is the URL-safe slug for the personal org (required).
// Usually derived from email or username.
PersonalOrgSlug string
// PersonalOrgName is the display name for the personal org (optional).
// Defaults to the user's DisplayName if not provided.
PersonalOrgName string
// Metadata contains optional metadata for the user.
Metadata map[string]any
}
SignupInput contains input for signing up a new user.
type SignupResult ¶
type SignupResult struct {
// Principal is the created human principal.
Principal *principal.Principal
// PersonalOrganization is the created personal organization.
PersonalOrganization *organization.Organization
// Membership is the owner membership in the personal organization.
Membership *organization.Membership
}
SignupResult contains the result of a signup operation.