wip

Ayman Bagabas created

Change summary

pkg/backend/org.go  |  4 ++--
pkg/proto/collab.go | 25 +++++++++++++++++++++++++
pkg/proto/org.go    |  6 +++---
pkg/proto/team.go   |  2 +-
pkg/ssh/cmd/org.go  |  4 ++--
pkg/ssh/cmd/team.go |  2 +-
6 files changed, 34 insertions(+), 9 deletions(-)

Detailed changes

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
 }

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
+}

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
 }

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

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
 		},
 	})

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
 		},
 	})