diff --git a/pkg/backend/org.go b/pkg/backend/org.go index 2fd7ee10d6b0bb85a4822622b3e2b69a02302ae6..20f94917a7874369cb682bbfa324b30fe16279fd 100644 --- a/pkg/backend/org.go +++ b/pkg/backend/org.go @@ -60,7 +60,7 @@ func (o org) ID() int64 { return o.o.ID } -// Name implements proto.Org. -func (o org) Name() string { +// Handle implements proto.Org. +func (o org) Handle() string { return o.o.Handle.Handle } diff --git a/pkg/proto/collab.go b/pkg/proto/collab.go new file mode 100644 index 0000000000000000000000000000000000000000..69be0f9f6f53ce8087e49c64bac8b08bea636e0c --- /dev/null +++ b/pkg/proto/collab.go @@ -0,0 +1,25 @@ +package proto + +import "github.com/charmbracelet/soft-serve/pkg/access" + +// CollaboratorType is a collaborator type. +type CollaboratorType int + +const ( + // CollaboratorTypeUser is a user collaborator. + CollaboratorTypeUser CollaboratorType = iota + // CollaboratorTypeTeam is a team collaborator. + CollaboratorTypeTeam +) + +// Collaborator is an interface representing a collaborator. +type Collaborator interface { + // ID returns the collaborator's ID. + ID() int64 + // Type returns the collaborator's type. + Type() CollaboratorType + // RepoID returns the repository ID. + RepoID() int64 + // AccessLevel returns the collaborator's access level for the repository. + AccessLevel() access.AccessLevel +} diff --git a/pkg/proto/org.go b/pkg/proto/org.go index 2809fd8afc6dee3d19da5491abc05be6b97dc322..ec17021cd24e0d449b1df805d39dbfde3c63b9e3 100644 --- a/pkg/proto/org.go +++ b/pkg/proto/org.go @@ -4,8 +4,8 @@ package proto type Org interface { // ID returns the user's ID. ID() int64 - // Name returns the org's name. - Name() string - // DisplayName + // Handle returns the org's name. + Handle() string + // DisplayName returns the org's display name. DisplayName() string } diff --git a/pkg/proto/team.go b/pkg/proto/team.go index 516da581f358be98afd9ea180765aedecf8c3ad3..b8369987eba6a54f164c41f8d6bf117363088c90 100644 --- a/pkg/proto/team.go +++ b/pkg/proto/team.go @@ -4,7 +4,7 @@ package proto type Team interface { // ID returns the user's ID. ID() int64 - // Name returns the org's name. + // Name returns the team's name. Name() string // Parent organization's ID. Org() int64 diff --git a/pkg/ssh/cmd/org.go b/pkg/ssh/cmd/org.go index 1d1a5fe15c6ac079485b8be3a603c6dae9aa484a..57404fd7360a2fa537ff2fd225e751f969ff274c 100644 --- a/pkg/ssh/cmd/org.go +++ b/pkg/ssh/cmd/org.go @@ -45,7 +45,7 @@ func OrgCommand() *cobra.Command { return err } for _, o := range orgs { - cmd.Println(o.Name()) + cmd.Println(o.Handle()) } return nil }, @@ -81,7 +81,7 @@ func OrgCommand() *cobra.Command { if err != nil { return err } - cmd.Println(org.Name()) + cmd.Println(org.Handle()) return nil }, }) diff --git a/pkg/ssh/cmd/team.go b/pkg/ssh/cmd/team.go index c0d1c29197ff41b9ef6ed9771c88a439503d9ddf..e10a7780fbed88715dbfc3aa3d6f2d361d93d783 100644 --- a/pkg/ssh/cmd/team.go +++ b/pkg/ssh/cmd/team.go @@ -112,7 +112,7 @@ func TeamCommand() *cobra.Command { return err } - cmd.Println(org.Name(), "/", team.Name()) + cmd.Println(org.Handle(), "/", team.Name()) return nil }, })