[management] get current user endpoint (#3666)

This commit is contained in:
Pedro Maia Costa
2025-04-15 11:06:07 +01:00
committed by GitHub
parent b165f63327
commit 75bdd47dfb
10 changed files with 442 additions and 19 deletions

View File

@@ -80,3 +80,16 @@ func (a *UsersAPI) ResendInvitation(ctx context.Context, userID string) error {
return nil
}
// Current gets the current user info
// See more: https://docs.netbird.io/api/resources/users#retrieve-current-user
func (a *UsersAPI) Current(ctx context.Context) (*api.User, error) {
resp, err := a.c.newRequest(ctx, "GET", "/api/users/current", nil)
if err != nil {
return nil, err
}
defer resp.Body.Close()
ret, err := parseResponse[api.User](resp)
return &ret, err
}