contract

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package contract wires the organization plugin's intent surface into the forge-dashboard contract registry. The `/organizations` page itself remains declared on the auth contributor — only the intent handlers + their declarations move here. Cross-contributor invocations work because the dashboard's contract dispatcher routes by intent name globally.

handlers.go: organization intent handlers owned by the organization plugin. Phase D.3 moved these from the auth contributor's handlers_organizations.go. The plugin handle arrives via Deps so we skip the engine.Plugin("organization") indirection the auth-contributor version used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(
	d *dispatcher.Dispatcher,
	reg contract.Registry,
	wreg contract.WardenRegistry,
	deps Deps,
) error

Types

type AddMemberInput

type AddMemberInput struct {
	OrgID  string `json:"orgId"`
	UserID string `json:"userId"`
	Email  string `json:"email,omitempty"`
	Role   string `json:"role,omitempty"`
}

type CreateInvitationInput

type CreateInvitationInput struct {
	OrgID string `json:"orgId"`
	Email string `json:"email"`
	Role  string `json:"role,omitempty"`
}

type CreateInvitationResponse

type CreateInvitationResponse struct {
	InvitationSummary
	Token string `json:"token"`
}

type CreateOrgInput

type CreateOrgInput struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type DeleteOrgInput

type DeleteOrgInput struct {
	ID string `json:"id"`
}

type Deps

type Deps struct {
	Engine *authsome.Engine
	Plugin OrgService
}

Deps carries the typed plugin handle alongside the engine so the handlers can call CreateOrganization / GetOrganization / etc. directly without engine.Plugin("organization") indirection. Plugin is typed as the local OrgService interface (cycle avoidance).

type GetOrgInput

type GetOrgInput struct {
	ID string `json:"id"`
}

type InvitationSummary

type InvitationSummary struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Role      string `json:"role"`
	Status    string `json:"status"`
	CreatedAt string `json:"createdAt"`
	ExpiresAt string `json:"expiresAt"`
}

type InvitationsListResponse

type InvitationsListResponse struct {
	Invitations []InvitationSummary `json:"invitations"`
}

type ListInvitationsInput

type ListInvitationsInput struct {
	OrgID string `json:"orgId"`
}

type ListMembersInput

type ListMembersInput struct {
	OrgID string `json:"orgId"`
}

type MemberSummary

type MemberSummary struct {
	ID        string `json:"id"`
	UserID    string `json:"userId"`
	Role      string `json:"role"`
	CreatedAt string `json:"createdAt"`
}

type MembersListResponse

type MembersListResponse struct {
	Members []MemberSummary `json:"members"`
}

type OrgDetail

type OrgDetail struct {
	OrgSummary
	AppID     string            `json:"appId,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
	UpdatedAt string            `json:"updatedAt"`
}

type OrgListResponse

type OrgListResponse struct {
	Organizations []OrgSummary `json:"organizations"`
}

type OrgService

type OrgService interface {
	AdminListOrganizations(ctx context.Context, appID id.AppID) ([]*organization.Organization, error)
	GetOrganization(ctx context.Context, orgID id.OrgID) (*organization.Organization, error)
	CreateOrganization(ctx context.Context, o *organization.Organization) error
	UpdateOrganization(ctx context.Context, o *organization.Organization) error
	DeleteOrganization(ctx context.Context, orgID id.OrgID) error
	ListMembers(ctx context.Context, orgID id.OrgID) ([]*organization.Member, error)
	AddMember(ctx context.Context, m *organization.Member) error
	RemoveMember(ctx context.Context, memberID id.MemberID) error
	ListInvitations(ctx context.Context, orgID id.OrgID) ([]*organization.Invitation, error)
	CreateInvitation(ctx context.Context, inv *organization.Invitation) error
}

OrgService is the surface of the organization plugin the contract handlers need. Declared here as an interface so this package doesn't import plugins/organization directly (which would create a cycle: plugins/organization → plugins/organization/contract → plugins/organization). The parent plugin's contract.go satisfies this interface by passing its own *Plugin into Deps.

type OrgSummary

type OrgSummary struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	CreatedAt string `json:"createdAt"`
}

type RemoveMemberInput

type RemoveMemberInput struct {
	ID string `json:"id"`
}

type UpdateOrgInput

type UpdateOrgInput struct {
	ID   string  `json:"id"`
	Name *string `json:"name,omitempty"`
}

Jump to

Keyboard shortcuts

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