github.com/newrelic/newrelic-client-go@v1.1.0/pkg/users/users_api.go (about)

     1  // Code generated by tutone: DO NOT EDIT
     2  package users
     3  
     4  import "context"
     5  
     6  // The `User` that is associated with the API key used in this request.
     7  func (a *Users) GetUser() (*User, error) {
     8  	return a.GetUserWithContext(context.Background())
     9  }
    10  
    11  // The `User` that is associated with the API key used in this request.
    12  func (a *Users) GetUserWithContext(
    13  	ctx context.Context,
    14  ) (*User, error) {
    15  
    16  	resp := userResponse{}
    17  	vars := map[string]interface{}{}
    18  
    19  	if err := a.client.NerdGraphQueryWithContext(ctx, getUserQuery, vars, &resp); err != nil {
    20  		return nil, err
    21  	}
    22  
    23  	return &resp.Actor.User, nil
    24  }
    25  
    26  const getUserQuery = `query { actor { user {
    27  	email
    28  	id
    29  	name
    30  } } }`