@@ -198,14 +198,14 @@ func (s *Service) usePublicAPI(ctx context.Context) bool {
198
198
}
199
199
200
200
func (s * Service ) GetToken (ctx context.Context , query * gitpod.GetTokenSearchOptions ) (res * gitpod.Token , err error ) {
201
+ if s == nil {
202
+ return nil , errNotConnected
203
+ }
201
204
startTime := time .Now ()
202
205
usePublicApi := s .usePublicAPI (ctx )
203
206
defer func () {
204
207
s .apiMetrics .ProcessMetrics (usePublicApi , "GetToken" , err , startTime )
205
208
}()
206
- if s == nil {
207
- return nil , errNotConnected
208
- }
209
209
if ! usePublicApi {
210
210
return s .gitpodService .GetToken (ctx , query )
211
211
}
@@ -230,14 +230,14 @@ func (s *Service) GetToken(ctx context.Context, query *gitpod.GetTokenSearchOpti
230
230
}
231
231
232
232
func (s * Service ) UpdateGitStatus (ctx context.Context , status * gitpod.WorkspaceInstanceRepoStatus ) (err error ) {
233
+ if s == nil {
234
+ return errNotConnected
235
+ }
233
236
startTime := time .Now ()
234
237
usePublicApi := s .usePublicAPI (ctx )
235
238
defer func () {
236
239
s .apiMetrics .ProcessMetrics (usePublicApi , "UpdateGitStatus" , err , startTime )
237
240
}()
238
- if s == nil {
239
- return errNotConnected
240
- }
241
241
workspaceID := s .cfg .WorkspaceID
242
242
if ! usePublicApi {
243
243
return s .gitpodService .UpdateGitStatus (ctx , workspaceID , status )
@@ -263,14 +263,14 @@ func (s *Service) UpdateGitStatus(ctx context.Context, status *gitpod.WorkspaceI
263
263
}
264
264
265
265
func (s * Service ) OpenPort (ctx context.Context , port * gitpod.WorkspaceInstancePort ) (res * gitpod.WorkspaceInstancePort , err error ) {
266
+ if s == nil {
267
+ return nil , errNotConnected
268
+ }
266
269
startTime := time .Now ()
267
270
usePublicApi := s .usePublicAPI (ctx )
268
271
defer func () {
269
272
s .apiMetrics .ProcessMetrics (usePublicApi , "OpenPort" , err , startTime )
270
273
}()
271
- if s == nil {
272
- return nil , errNotConnected
273
- }
274
274
workspaceID := s .cfg .WorkspaceID
275
275
if ! usePublicApi {
276
276
return s .gitpodService .OpenPort (ctx , workspaceID , port )
@@ -304,14 +304,14 @@ func (s *Service) OpenPort(ctx context.Context, port *gitpod.WorkspaceInstancePo
304
304
}
305
305
306
306
func (s * Service ) GetDefaultWorkspaceImage (ctx context.Context ) (image string , err error ) {
307
+ if s == nil {
308
+ return "" , errNotConnected
309
+ }
307
310
startTime := time .Now ()
308
311
usePublicApi := s .usePublicAPI (ctx )
309
312
defer func () {
310
313
s .apiMetrics .ProcessMetrics (usePublicApi , "GetDefaultWorkspaceImage" , nil , startTime )
311
314
}()
312
- if s == nil {
313
- return "" , errNotConnected
314
- }
315
315
workspaceID := s .cfg .WorkspaceID
316
316
if ! usePublicApi {
317
317
resp , err := s .gitpodService .GetDefaultWorkspaceImage (ctx , & gitpod.GetDefaultWorkspaceImageParams {
0 commit comments