GetPersonalAccessToken
client.Users.Pats.Get(ctx, body) (*UserPatGetResponse, error)
POST/gitpod.v1.UserService/GetPersonalAccessToken
Gets details about a specific personal access token.
Use this method to:
- View token metadata
- Check token expiration
- Monitor token usage
Examples
-
Get token details:
Retrieves information about a specific token.
personalAccessTokenId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
GetPersonalAccessToken
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"),
)
pat, err := client.Users.Pats.Get(context.TODO(), gitpod.UserPatGetParams{
PersonalAccessTokenID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", pat.Pat)
}
{
"pat": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"lastUsed": "2019-12-27T18:11:19.117Z",
"readOnly": true,
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}Returns Examples
{
"pat": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"description": "description",
"expiresAt": "2019-12-27T18:11:19.117Z",
"lastUsed": "2019-12-27T18:11:19.117Z",
"readOnly": true,
"userId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}