MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / GetUser

Function GetUser

cli/internal/auth/identify.go:13–28  ·  view source on GitHub ↗
(ctx context.Context, token auth.Token)

Source from the content-addressed store, hash-verified

11)
12
13func GetUser(ctx context.Context, token auth.Token) (*cqapi.User, error) {
14 apiClient, err := api.NewClient(token.Value)
15 if err != nil {
16 return nil, fmt.Errorf("failed to create api client: %w", err)
17 }
18 resp, err := apiClient.GetCurrentUserWithResponse(ctx)
19 if err != nil {
20 return nil, fmt.Errorf("failed to get current user: %w", err)
21 }
22
23 if resp.StatusCode() != http.StatusOK {
24 return nil, fmt.Errorf("failed to get current user, status code: %s", resp.Status())
25 }
26
27 return resp.JSON200, nil
28}

Callers

nothing calls this directly

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected