Skip to content

Commit ba5ce02

Browse files
committed
[gitpod-protocol] Add getGenericInvite to golang client
1 parent 2b82c4b commit ba5ce02

File tree

2 files changed

+62
-18
lines changed

2 files changed

+62
-18
lines changed

Diff for: components/gitpod-protocol/go/gitpod-service.go

+35-6
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ type APIInterface interface {
8484
TrackEvent(ctx context.Context, event *RemoteTrackMessage) (err error)
8585
GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error)
8686

87-
CreateTeam(ctx context.Context, params string) (*Team, error)
88-
GetTeamMembers(ctx context.Context, params string) ([]*TeamMemberInfo, error)
89-
JoinTeam(ctx context.Context, params string) (*Team, error)
87+
CreateTeam(ctx context.Context, teamName string) (*Team, error)
88+
GetTeamMembers(ctx context.Context, teamID string) ([]*TeamMemberInfo, error)
89+
JoinTeam(ctx context.Context, teamID string) (*Team, error)
90+
GetGenericInvite(ctx context.Context, teamID string) (*TeamMembershipInvite, error)
9091

9192
InstanceUpdates(ctx context.Context, instanceID string) (<-chan *WorkspaceInstance, error)
9293
}
@@ -208,6 +209,15 @@ const (
208209
// FunctionGetSupportedWorkspaceClasses is the name of the getSupportedWorkspaceClasses function
209210
FunctionGetSupportedWorkspaceClasses FunctionName = "getSupportedWorkspaceClasses"
210211

212+
// FunctionCreateTeam is the name of the createTeam function
213+
FunctionCreateTeam FunctionName = "createTeam"
214+
// FunctionJoinTeam is the name of the joinTeam function
215+
FunctionJoinTeam FunctionName = "joinTeam"
216+
// FunctionGetTeamMembers is the name of the getTeamMembers function
217+
FunctionGetTeamMembers FunctionName = "getTeamMembers"
218+
// FunctionGetGenericInvite is the name of the getGenericInvite function
219+
FunctionGetGenericInvite FunctionName = "getGenericInvite"
220+
211221
// FunctionOnInstanceUpdate is the name of the onInstanceUpdate callback function
212222
FunctionOnInstanceUpdate = "onInstanceUpdate"
213223
)
@@ -1392,7 +1402,7 @@ func (gp *APIoverJSONRPC) CreateTeam(ctx context.Context, teamName string) (res
13921402
return
13931403
}
13941404
_params := []interface{}{teamName}
1395-
err = gp.C.Call(ctx, "createTeam", _params, &res)
1405+
err = gp.C.Call(ctx, string(FunctionCreateTeam), _params, &res)
13961406
return
13971407
}
13981408

@@ -1402,7 +1412,7 @@ func (gp *APIoverJSONRPC) GetTeamMembers(ctx context.Context, teamID string) (re
14021412
return
14031413
}
14041414
_params := []interface{}{teamID}
1405-
err = gp.C.Call(ctx, "getTeamMembers", _params, &res)
1415+
err = gp.C.Call(ctx, string(FunctionGetTeamMembers), _params, &res)
14061416
return
14071417
}
14081418

@@ -1412,7 +1422,17 @@ func (gp *APIoverJSONRPC) JoinTeam(ctx context.Context, inviteID string) (res *T
14121422
return
14131423
}
14141424
_params := []interface{}{inviteID}
1415-
err = gp.C.Call(ctx, "joinTeam", _params, &res)
1425+
err = gp.C.Call(ctx, string(FunctionJoinTeam), _params, &res)
1426+
return
1427+
}
1428+
1429+
func (gp *APIoverJSONRPC) GetGenericInvite(ctx context.Context, teamID string) (res *TeamMembershipInvite, err error) {
1430+
if gp == nil {
1431+
err = errNotConnected
1432+
return
1433+
}
1434+
_params := []interface{}{teamID}
1435+
err = gp.C.Call(ctx, string(FunctionGetGenericInvite), _params, &res)
14161436
return
14171437
}
14181438

@@ -2131,3 +2151,12 @@ type TeamMemberInfo struct {
21312151
Role TeamMemberRole `json:"role,omitempty"`
21322152
MemberSince string `json:"memberSince,omitempty"`
21332153
}
2154+
2155+
type TeamMembershipInvite struct {
2156+
ID string `json:"id,omitempty"`
2157+
TeamID string `json:"teamId,omitempty"`
2158+
Role TeamMemberRole `json:"role,omitempty"`
2159+
CreationTime string `json:"creationTime,omitempty"`
2160+
InvalidationTime string `json:"invalidationTime,omitempty"`
2161+
InvitedEmail string `json:"invitedEmail,omitempty"`
2162+
}

Diff for: components/gitpod-protocol/go/mock.go

+27-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)