MCPcopy Create free account
hub / github.com/openclaw/gogcli / patchAdminUserState

Function patchAdminUserState

internal/cmd/admin_users.go:295–315  ·  view source on GitHub ↗
(ctx context.Context, svc *admin.Service, userKey string, patch *admin.User)

Source from the content-addressed store, hash-verified

293}
294
295func patchAdminUserState(ctx context.Context, svc *admin.Service, userKey string, patch *admin.User) (*admin.User, error) {
296 const attempts = 6
297 var lastErr error
298 for attempt := range attempts {
299 updated, err := svc.Users.Patch(userKey, patch).Context(ctx).Do()
300 if err == nil {
301 return updated, nil
302 }
303 lastErr = err
304 var googleErr *ggoogleapi.Error
305 if !errors.As(err, &googleErr) || googleErr.Code != 404 || attempt == attempts-1 {
306 return nil, err
307 }
308 select {
309 case <-ctx.Done():
310 return nil, ctx.Err()
311 case <-time.After(500 * time.Millisecond):
312 }
313 }
314 return nil, lastErr
315}
316
317type AdminUsersDeleteCmd struct {
318 UserEmail string `arg:"" name:"userEmail" help:"User email to delete"`

Callers 1

RunMethod · 0.85

Calls 2

ErrMethod · 0.80
DoMethod · 0.65

Tested by

no test coverage detected