Skip to content
Ona Docs

GetUser

client.Users.GetUser(ctx, body) (*UserGetUserResponse, error)
POST/gitpod.v1.UserService/GetUser

Gets basic information about a specific user by their ID.

Use this method to:

  • Retrieve user profile information
  • Get user details for display purposes
  • Fetch user metadata for administrative tasks

Examples

  • Get user by ID:

    Retrieves basic user information by user ID.

    userId: "f53d2330-3795-4c5d-a1f3-453121af9c60"
ParametersExpand Collapse
body UserGetUserParams
UserID param.Field[string]Optional
formatuuid
ReturnsExpand Collapse
type UserGetUserResponse struct{…}
User User
ID string

id is a UUID of the user

formatuuid
AvatarURL stringOptional

avatar_url is a link to the user avatar

CreatedAt TimeOptional

created_at is the creation time

formatdate-time
Email stringOptional

email is the user’s email address

Name stringOptional

name is the full name of the user

OrganizationID stringOptional

organization_id is the id of the organization this account is owned by.

+optional if not set, this account is owned by the installation.

formatuuid
Status UserStatusOptional

status is the status the user is in

One of the following:
const UserStatusUnspecified UserStatus = "USER_STATUS_UNSPECIFIED"
const UserStatusActive UserStatus = "USER_STATUS_ACTIVE"
const UserStatusSuspended UserStatus = "USER_STATUS_SUSPENDED"
const UserStatusLeft UserStatus = "USER_STATUS_LEFT"

GetUser

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  response, err := client.Users.GetUser(context.TODO(), gitpod.UserGetUserParams{
    UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.User)
}
{
  "user": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "avatarUrl": "avatarUrl",
    "createdAt": "2019-12-27T18:11:19.117Z",
    "email": "email",
    "name": "name",
    "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "status": "USER_STATUS_UNSPECIFIED"
  }
}
Returns Examples
{
  "user": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "avatarUrl": "avatarUrl",
    "createdAt": "2019-12-27T18:11:19.117Z",
    "email": "email",
    "name": "name",
    "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "status": "USER_STATUS_UNSPECIFIED"
  }
}