Skip to content

Commit 71fc084

Browse files
committed
improve example for access tokens with the new field "Last used at"
1 parent 2b715bb commit 71fc084

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/04_access_tokens_management/04_access_tokens_management.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func main() {
3838
fmt.Printf(" Type: %s\n", token.Type)
3939
fmt.Printf(" Created by: %s at %s\n", token.CreatedBy, token.CreatedAt.Format(time.RFC3339))
4040
fmt.Printf(" Secret: %s (first 4 chars)\n", token.Secret)
41+
if token.LastUsedAt != nil && !token.LastUsedAt.IsZero() {
42+
fmt.Printf(" Last used at: %v\n", token.LastUsedAt)
43+
} else {
44+
fmt.Printf(" Wasn't used last 7 days")
45+
}
4146
fmt.Println()
4247
}
4348
}

0 commit comments

Comments
 (0)