From bd58d64011785a4c02f86a5667d6ffb0cd72e0a2 Mon Sep 17 00:00:00 2001 From: mustard Date: Wed, 24 Aug 2022 15:39:15 +0000 Subject: [PATCH] [gitpod-protocol] add missing method in golang --- .../gitpod-protocol/go/gitpod-service.go | 23 +++++++++++++++++++ components/gitpod-protocol/go/mock.go | 15 ++++++++++++ 2 files changed, 38 insertions(+) diff --git a/components/gitpod-protocol/go/gitpod-service.go b/components/gitpod-protocol/go/gitpod-service.go index 3eaeef9d9f2d41..5ade0a301746fa 100644 --- a/components/gitpod-protocol/go/gitpod-service.go +++ b/components/gitpod-protocol/go/gitpod-service.go @@ -82,6 +82,7 @@ type APIInterface interface { GetLayout(ctx context.Context, workspaceID string) (res string, err error) GuessGitTokenScopes(ctx context.Context, params *GuessGitTokenScopesParams) (res *GuessedGitTokenScopes, err error) TrackEvent(ctx context.Context, event *RemoteTrackMessage) (err error) + GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error) InstanceUpdates(ctx context.Context, instanceID string) (<-chan *WorkspaceInstance, error) } @@ -206,6 +207,8 @@ const ( FunctionGuessGitTokenScope FunctionName = "guessGitTokenScopes" // FunctionTrackEvent is the name of the trackEvent function FunctionTrackEvent FunctionName = "trackEvent" + // FunctionGetSupportedWorkspaceClasses is the name of the getSupportedWorkspaceClasses function + FunctionGetSupportedWorkspaceClasses FunctionName = "getSupportedWorkspaceClasses" // FunctionOnInstanceUpdate is the name of the onInstanceUpdate callback function FunctionOnInstanceUpdate = "onInstanceUpdate" @@ -1434,6 +1437,16 @@ func (gp *APIoverJSONRPC) TrackEvent(ctx context.Context, params *RemoteTrackMes return } +func (gp *APIoverJSONRPC) GetSupportedWorkspaceClasses(ctx context.Context) (res []*SupportedWorkspaceClass, err error) { + if gp == nil { + err = errNotConnected + return + } + _params := []interface{}{} + err = gp.C.Call(ctx, "getSupportedWorkspaceClasses", _params, &res) + return +} + // PermissionName is the name of a permission type PermissionName string @@ -1937,6 +1950,16 @@ type GuessedGitTokenScopes struct { Message string `json:"message,omitempty"` } +// SupportedWorkspaceClass is the GetSupportedWorkspaceClasses message type +type SupportedWorkspaceClass struct { + ID string `json:"id,omitempty"` + Category string `json:"category,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Description string `json:"description,omitempty"` + Powerups int `json:"powerups,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` +} + type RemoteTrackMessage struct { Event string `json:"event,omitempty"` Properties interface{} `json:"properties,omitempty"` diff --git a/components/gitpod-protocol/go/mock.go b/components/gitpod-protocol/go/mock.go index e963837adfaaae..f50826801d5461 100644 --- a/components/gitpod-protocol/go/mock.go +++ b/components/gitpod-protocol/go/mock.go @@ -464,6 +464,21 @@ func (mr *MockAPIInterfaceMockRecorder) GetSnapshots(ctx, workspaceID interface{ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSnapshots", reflect.TypeOf((*MockAPIInterface)(nil).GetSnapshots), ctx, workspaceID) } +// GetSupportedWorkspaceClasses mocks base method. +func (m *MockAPIInterface) GetSupportedWorkspaceClasses(ctx context.Context) ([]*SupportedWorkspaceClass, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSupportedWorkspaceClasses", ctx) + ret0, _ := ret[0].([]*SupportedWorkspaceClass) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSupportedWorkspaceClasses indicates an expected call of GetSupportedWorkspaceClasses. +func (mr *MockAPIInterfaceMockRecorder) GetSupportedWorkspaceClasses(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSupportedWorkspaceClasses", reflect.TypeOf((*MockAPIInterface)(nil).GetSupportedWorkspaceClasses), ctx) +} + // GetToken mocks base method. func (m *MockAPIInterface) GetToken(ctx context.Context, query *GetTokenSearchOptions) (*Token, error) { m.ctrl.T.Helper()