clerkhooks

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	// contains filtered or unexported methods
}

type AppClient

type AppClient interface {
	CreateMembership(ctx context.Context, data *CreateMembershipData) error
	CreateOrganization(ctx context.Context, data *CreateOrgData) (*Organization, error)
	CreateUser(ctx context.Context, data *CreateUserData) (*User, error)
	DeleteMembership(ctx context.Context, orgID pulid.ID, userID pulid.ID) error
	GetUser(ctx context.Context, userID pulid.ID) (*User, error)
	GetUserByAccountID(ctx context.Context, accountID string) (*User, error)
	MembershipExists(ctx context.Context, orgID pulid.ID, userID pulid.ID) (bool, error)
	SetOrgDetails(ctx context.Context, orgID pulid.ID, data *OrgInputData) error
	SetUserProfileDetails(ctx context.Context, userID pulid.ID, data *UserInputData) error
	UpdateMembership(
		ctx context.Context,
		data *CreateMembershipData,
	) error
}

type ClerkHook

type ClerkHook struct {
	// contains filtered or unexported fields
}

func NewClerkWebhook

func NewClerkWebhook(appClient AppClient, wh *svix.Webhook) *ClerkHook

func (*ClerkHook) GetUserByAccountID

func (c *ClerkHook) GetUserByAccountID(
	ctx context.Context,
	accountID string,
) (*User, error)

func (*ClerkHook) HandleHooks

func (c *ClerkHook) HandleHooks(
	ctx context.Context,
	w http.ResponseWriter,
	r *http.Request,
	secretKey string,
	opts ...ClerkHookOption,
) error

type ClerkHookOption

type ClerkHookOption func(*clerkHookOptions)

func WithPersonalOrgs

func WithPersonalOrgs(shouldCreatePersonalOrg bool) ClerkHookOption

type CreateMembershipData

type CreateMembershipData struct {
	OrgID  pulid.ID
	UserID pulid.ID
	Role   membershiprole.MembershipRole
}

type CreateOrgData

type CreateOrgData struct {
	UserID       pulid.ID
	OrgAccountID string
	OrgInputData
}

type CreateUserData

type CreateUserData struct {
	AccountID               string
	IsEmployee              bool
	ShouldCreatePersonalOrg bool
	UserInputData
}

type OrgInputData

type OrgInputData struct {
	Name     string
	ImageURL string
}

type Organization

type Organization struct {
	ID pulid.ID
}

type User

type User struct {
	ID            pulid.ID
	PersonalOrgID *pulid.ID
}

type UserInputData

type UserInputData struct {
	FirstName    string
	LastName     string
	Username     *string
	ImageURL     string
	EmailAddress *string
	Phone        *string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL