org

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMemberRequest

type AddMemberRequest struct {
	UserID string `json:"user_id" validate:"required"`
	Role   string `json:"role" validate:"required"`
}

type CreateInvitationRequest

type CreateInvitationRequest struct {
	Email string `json:"email" validate:"required,email"`
	Role  string `json:"role" validate:"required"`
}

type CreateOrgRequest

type CreateOrgRequest struct {
	Slug     string                 `json:"slug" validate:"required"`
	Name     string                 `json:"name" validate:"required"`
	ParentID *string                `json:"parent_id"`
	Settings map[string]interface{} `json:"settings"`
}

type CreateSSORequest

type CreateSSORequest struct {
	Provider string                 `json:"provider" validate:"required"`
	Config   map[string]interface{} `json:"config" validate:"required"`
	Domain   string                 `json:"domain"`
	Enabled  bool                   `json:"enabled"`
}

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) AddMember

func (h *Handler) AddMember(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateInvitation

func (h *Handler) CreateInvitation(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateOrg

func (h *Handler) CreateOrg(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateSSO

func (h *Handler) CreateSSO(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteOrg

func (h *Handler) DeleteOrg(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteSSO

func (h *Handler) DeleteSSO(w http.ResponseWriter, r *http.Request)

func (*Handler) GetOrg

func (h *Handler) GetOrg(w http.ResponseWriter, r *http.Request)

func (*Handler) GetSSO

func (h *Handler) GetSSO(w http.ResponseWriter, r *http.Request)

func (*Handler) ListInvitations

func (h *Handler) ListInvitations(w http.ResponseWriter, r *http.Request)

func (*Handler) ListMembers

func (h *Handler) ListMembers(w http.ResponseWriter, r *http.Request)

func (*Handler) ListOrgs

func (h *Handler) ListOrgs(w http.ResponseWriter, r *http.Request)

func (*Handler) ListSSO

func (h *Handler) ListSSO(w http.ResponseWriter, r *http.Request)

func (*Handler) RemoveMember

func (h *Handler) RemoveMember(w http.ResponseWriter, r *http.Request)

func (*Handler) RevokeInvitation

func (h *Handler) RevokeInvitation(w http.ResponseWriter, r *http.Request)

func (*Handler) Routes

func (h *Handler) Routes() chi.Router

func (*Handler) UpdateMemberRole

func (h *Handler) UpdateMemberRole(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateOrg

func (h *Handler) UpdateOrg(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateSSO

func (h *Handler) UpdateSSO(w http.ResponseWriter, r *http.Request)

type Invitation

type Invitation struct {
	ID        string    `json:"id"`
	OrgID     string    `json:"org_id"`
	Email     string    `json:"email"`
	Role      string    `json:"role"`
	Token     string    `json:"token,omitempty"`
	Status    string    `json:"status"`
	InviterID string    `json:"inviter_id"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

type Member

type Member struct {
	ID          string    `json:"id"`
	OrgID       string    `json:"org_id"`
	UserID      string    `json:"user_id"`
	Role        string    `json:"role"`
	Email       string    `json:"email,omitempty"`
	DisplayName string    `json:"display_name,omitempty"`
	AvatarURL   string    `json:"avatar_url,omitempty"`
	UserStatus  string    `json:"user_status,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
}

type Org

type Org struct {
	ID        string                 `json:"id"`
	Slug      string                 `json:"slug"`
	Name      string                 `json:"name"`
	ParentID  *string                `json:"parent_id,omitempty"`
	Settings  map[string]interface{} `json:"settings"`
	Status    string                 `json:"status"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
}

type SSOConnection

type SSOConnection struct {
	ID        string                 `json:"id"`
	OrgID     string                 `json:"org_id"`
	Provider  string                 `json:"provider"`
	Config    map[string]interface{} `json:"config"`
	Domain    string                 `json:"domain"`
	Enabled   bool                   `json:"enabled"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
}

type Service

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

func NewService

func NewService(pool *pgxpool.Pool) *Service

func (*Service) AcceptInvitation

func (s *Service) AcceptInvitation(ctx context.Context, token, userID string) error

AcceptInvitation accepts an invitation by token and adds the user to the org.

func (*Service) AddMember

func (s *Service) AddMember(ctx context.Context, orgID string, req AddMemberRequest) (*Member, error)

func (*Service) CreateInvitation

func (s *Service) CreateInvitation(ctx context.Context, orgID, inviterID string, req CreateInvitationRequest) (*Invitation, error)

func (*Service) CreateOrg

func (s *Service) CreateOrg(ctx context.Context, req CreateOrgRequest) (*Org, error)

func (*Service) CreateSSO

func (s *Service) CreateSSO(ctx context.Context, orgID string, req CreateSSORequest) (*SSOConnection, error)

func (*Service) DeleteOrg

func (s *Service) DeleteOrg(ctx context.Context, id string) error

func (*Service) DeleteSSO

func (s *Service) DeleteSSO(ctx context.Context, id string) error

func (*Service) GetOrg

func (s *Service) GetOrg(ctx context.Context, id string) (*Org, error)

func (*Service) GetSSO

func (s *Service) GetSSO(ctx context.Context, id string) (*SSOConnection, error)

func (*Service) ListInvitations

func (s *Service) ListInvitations(ctx context.Context, orgID string) ([]Invitation, error)

func (*Service) ListMembers

func (s *Service) ListMembers(ctx context.Context, orgID string, limit, offset int) ([]Member, int64, error)

func (*Service) ListOrgs

func (s *Service) ListOrgs(ctx context.Context, limit, offset int) ([]Org, int64, error)

func (*Service) ListSSO

func (s *Service) ListSSO(ctx context.Context, orgID string) ([]SSOConnection, error)

func (*Service) RemoveMember

func (s *Service) RemoveMember(ctx context.Context, orgID, userID string) error

func (*Service) RevokeInvitation

func (s *Service) RevokeInvitation(ctx context.Context, inviteID string) error

func (*Service) UpdateMemberRole

func (s *Service) UpdateMemberRole(ctx context.Context, orgID, userID, role string) error

func (*Service) UpdateOrg

func (s *Service) UpdateOrg(ctx context.Context, id string, req UpdateOrgRequest) (*Org, error)

func (*Service) UpdateSSO

func (s *Service) UpdateSSO(ctx context.Context, id string, req UpdateSSORequest) (*SSOConnection, error)

type UpdateMemberRequest

type UpdateMemberRequest struct {
	Role string `json:"role" validate:"required"`
}

type UpdateOrgRequest

type UpdateOrgRequest struct {
	Name     *string                `json:"name"`
	Slug     *string                `json:"slug"`
	Settings map[string]interface{} `json:"settings"`
}

type UpdateSSORequest

type UpdateSSORequest struct {
	Provider *string                `json:"provider"`
	Config   map[string]interface{} `json:"config"`
	Domain   *string                `json:"domain"`
	Enabled  *bool                  `json:"enabled"`
}

Jump to

Keyboard shortcuts

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