Skip to content

[gitpod-protocol] Add createTeam, joinTeam, getTeamMembers to Go lib #14170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ type APIInterface interface {
TrackEvent(ctx context.Context, event *RemoteTrackMessage) (err error)
GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error)

CreateTeam(ctx context.Context, params string) (*Team, error)
GetTeamMembers(ctx context.Context, params string) ([]*TeamMemberInfo, error)
JoinTeam(ctx context.Context, params string) (*Team, error)

InstanceUpdates(ctx context.Context, instanceID string) (<-chan *WorkspaceInstance, error)
}

Expand Down Expand Up @@ -1382,6 +1386,36 @@ func (gp *APIoverJSONRPC) GetSupportedWorkspaceClasses(ctx context.Context) (res
return
}

func (gp *APIoverJSONRPC) CreateTeam(ctx context.Context, teamName string) (res *Team, err error) {
if gp == nil {
err = errNotConnected
return
}
_params := []interface{}{teamName}
err = gp.C.Call(ctx, "createTeam", _params, &res)
return
}

func (gp *APIoverJSONRPC) GetTeamMembers(ctx context.Context, teamID string) (res []*TeamMemberInfo, err error) {
if gp == nil {
err = errNotConnected
return
}
_params := []interface{}{teamID}
err = gp.C.Call(ctx, "getTeamMembers", _params, &res)
return
}

func (gp *APIoverJSONRPC) JoinTeam(ctx context.Context, inviteID string) (res *Team, err error) {
if gp == nil {
err = errNotConnected
return
}
_params := []interface{}{inviteID}
err = gp.C.Call(ctx, "joinTeam", _params, &res)
return
}

// PermissionName is the name of a permission
type PermissionName string

Expand Down Expand Up @@ -2074,3 +2108,26 @@ type UserMessage struct {
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
}

type Team struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
CreationTime string `json:"creationTime,omitempty"`
}

type TeamMemberRole string

const (
TeamMember_Owner TeamMemberRole = "owner"
TeamMember_Member TeamMemberRole = "member"
)

type TeamMemberInfo struct {
UserId string `json:"userId,omitempty"`
FullName string `json:"fullName,omitempty"`
PrimaryEmail string `json:"primaryEmail,omitempty"`
AvatarUrl string `json:"avatarUrl,omitempty"`
Role TeamMemberRole `json:"role,omitempty"`
MemberSince string `json:"memberSince,omitempty"`
}
45 changes: 45 additions & 0 deletions components/gitpod-protocol/go/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.