Versions in this module Expand all Collapse all v0 v0.10.0 Sep 6, 2026 Changes in this version + const RoleAdmin + const RoleMember + const RoleOwner + type API struct + func NewAPI(service Service, config APIConfig) *API + func (a *API) Router() chi.Router + func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request) + type APIConfig struct + BasePath string + Logger *slog.Logger + func DefaultAPIConfig() APIConfig + type AddMemberInput struct + OrganizationID uuid.UUID + Permissions []string + PrincipalID uuid.UUID + Role string + type AddMemberRequest struct + Body struct{ ... } + Slug string + type AddMemberResponse struct + Body *MemberResponse + type CheckSlugInput struct + Slug string + type CheckSlugOutput struct + Body struct{ ... } + type CreateOrgInput struct + Body struct{ ... } + type CreateOrgOutput struct + Body *OrgResponse + type CreateOrganizationInput struct + Description *string + LogoURL *string + Name string + OrgType OrgType + OwnerPrincipalID *uuid.UUID + Plan Plan + Settings map[string]any + Slug string + WebsiteURL *string + type CreatePersonalOrgInput struct + LogoURL *string + Name string + OwnerPrincipalID uuid.UUID + Slug string + type DefaultService struct + func (s *DefaultService) AddMember(ctx context.Context, input AddMemberInput) (*Membership, error) + func (s *DefaultService) Create(ctx context.Context, input CreateOrganizationInput) (*Organization, error) + func (s *DefaultService) CreatePersonalOrg(ctx context.Context, input CreatePersonalOrgInput) (*Organization, error) + func (s *DefaultService) Delete(ctx context.Context, id uuid.UUID) error + func (s *DefaultService) GenerateSlug(ctx context.Context, name string) (string, error) + func (s *DefaultService) GetByID(ctx context.Context, id uuid.UUID) (*Organization, error) + func (s *DefaultService) GetBySlug(ctx context.Context, slug string) (*Organization, error) + func (s *DefaultService) GetMembership(ctx context.Context, organizationID, principalID uuid.UUID) (*Membership, error) + func (s *DefaultService) GetPersonalOrg(ctx context.Context, principalID uuid.UUID) (*Organization, error) + func (s *DefaultService) List(ctx context.Context, input ListOrganizationsInput) ([]*Organization, error) + func (s *DefaultService) ListMembers(ctx context.Context, organizationID uuid.UUID) ([]*Membership, error) + func (s *DefaultService) ListMemberships(ctx context.Context, principalID uuid.UUID) ([]*Membership, error) + func (s *DefaultService) RemoveMember(ctx context.Context, organizationID, principalID uuid.UUID) error + func (s *DefaultService) SlugAvailable(ctx context.Context, slug string) (bool, error) + func (s *DefaultService) TransferOwnership(ctx context.Context, input TransferOwnershipInput) error + func (s *DefaultService) Update(ctx context.Context, id uuid.UUID, input UpdateOrganizationInput) (*Organization, error) + func (s *DefaultService) UpdateMember(ctx context.Context, membershipID uuid.UUID, input UpdateMemberInput) (*Membership, error) + type DeleteOrgInput struct + Slug string + type GetMemberInput struct + PrincipalID string + Slug string + type GetMemberOutput struct + Body *MemberResponse + type GetOrgInput struct + Slug string + type GetOrgOutput struct + Body *OrgResponse + type ListMembersInput struct + Slug string + type ListMembersOutput struct + Body struct{ ... } + type ListOrganizationsInput struct + Active *bool + Limit int + Offset int + OrgType *OrgType + Plan *Plan + type ListOrgsInput struct + Active *bool + Limit int + Offset int + OrgType *string + Plan *string + type ListOrgsOutput struct + Body struct{ ... } + type MemberResponse struct + Active bool + CreatedAt time.Time + ID string + OrganizationID string + Permissions []string + PrincipalID string + Role string + UpdatedAt time.Time + type Membership struct + Active bool + CreatedAt time.Time + ID uuid.UUID + OrganizationID uuid.UUID + Permissions []string + PrincipalID uuid.UUID + Role string + UpdatedAt time.Time + type OrgResponse struct + Active bool + CreatedAt time.Time + Description *string + ID string + LogoURL *string + Name string + OrgType string + OwnerPrincipalID *string + Plan string + Settings map[string]any + Slug string + UpdatedAt time.Time + WebsiteURL *string + type OrgType string + const OrgTypeEnterprise + const OrgTypePersonal + const OrgTypeTeam + type Organization struct + Active bool + CreatedAt time.Time + Description *string + ID uuid.UUID + LogoURL *string + Name string + OrgType OrgType + OwnerPrincipalID *uuid.UUID + Plan Plan + Settings map[string]any + Slug string + UpdatedAt time.Time + WebsiteURL *string + func (o *Organization) IsPersonal() bool + type Plan string + const PlanEnterprise + const PlanFree + const PlanPro + const PlanStarter + type RemoveMemberInput struct + PrincipalID string + Slug string + type Service interface + AddMember func(ctx context.Context, input AddMemberInput) (*Membership, error) + Create func(ctx context.Context, input CreateOrganizationInput) (*Organization, error) + CreatePersonalOrg func(ctx context.Context, input CreatePersonalOrgInput) (*Organization, error) + Delete func(ctx context.Context, id uuid.UUID) error + GenerateSlug func(ctx context.Context, name string) (string, error) + GetByID func(ctx context.Context, id uuid.UUID) (*Organization, error) + GetBySlug func(ctx context.Context, slug string) (*Organization, error) + GetMembership func(ctx context.Context, organizationID, principalID uuid.UUID) (*Membership, error) + GetPersonalOrg func(ctx context.Context, principalID uuid.UUID) (*Organization, error) + List func(ctx context.Context, input ListOrganizationsInput) ([]*Organization, error) + ListMembers func(ctx context.Context, organizationID uuid.UUID) ([]*Membership, error) + ListMemberships func(ctx context.Context, principalID uuid.UUID) ([]*Membership, error) + RemoveMember func(ctx context.Context, organizationID, principalID uuid.UUID) error + SlugAvailable func(ctx context.Context, slug string) (bool, error) + TransferOwnership func(ctx context.Context, input TransferOwnershipInput) error + Update func(ctx context.Context, id uuid.UUID, input UpdateOrganizationInput) (*Organization, error) + UpdateMember func(ctx context.Context, membershipID uuid.UUID, input UpdateMemberInput) (*Membership, error) + func NewService(client *ent.Client, opts ...ServiceOption) Service + type ServiceOption func(*DefaultService) + func WithAuthzSyncer(syncer authz.RelationshipSyncer) ServiceOption + func WithLogger(logger *slog.Logger) ServiceOption + func WithSyncMode(mode authz.SyncMode) ServiceOption + type TransferOwnershipInput struct + FromPrincipal uuid.UUID + NewRoleForOld string + OrganizationID uuid.UUID + ToPrincipal uuid.UUID + type TransferOwnershipRequest struct + Body struct{ ... } + Slug string + type TransferOwnershipResponse struct + Body struct{ ... } + type UpdateMemberInput struct + Active *bool + Permissions []string + Role *string + type UpdateMemberRequest struct + Body struct{ ... } + PrincipalID string + Slug string + type UpdateMemberResponse struct + Body *MemberResponse + type UpdateOrgInput struct + Body struct{ ... } + Slug string + type UpdateOrgOutput struct + Body *OrgResponse + type UpdateOrganizationInput struct + Description *string + LogoURL *string + Name *string + Plan *Plan + Settings map[string]any + WebsiteURL *string