Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add last_login field to User struct #583

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

zliang-akamai
Copy link
Member

📝 Description

The field was previously missing, adding it to the struct now.

✔️ How to Test

make fixtures ARGS="-run TestUser"
package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/linode/linodego"
	"golang.org/x/oauth2"
)

func main() {
	apiKey, ok := os.LookupEnv("LINODE_TOKEN")
	if !ok {
		log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
	}
	tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})

	oauth2Client := &http.Client{
		Transport: &oauth2.Transport{
			Source: tokenSource,
		},
	}

	linodeClient := linodego.NewClient(oauth2Client)
	linodeClient.SetDebug(true)

	usr, _ := linodeClient.GetUser(context.Background(), "YOUR_USERNAME")
	fmt.Println(usr.LastLogin.Status)
}

@zliang-akamai zliang-akamai requested a review from a team as a code owner September 18, 2024 19:20
@zliang-akamai zliang-akamai requested review from lgarber-akamai and ykim-akamai and removed request for a team September 18, 2024 19:20
Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the quick follow up 👍

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@zliang-akamai zliang-akamai merged commit a424a08 into linode:main Sep 19, 2024
4 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/user-last-login branch September 19, 2024 15:10
@zliang-akamai zliang-akamai added improvement for improvements in existing functionality in the changelog. new-feature for new features in the changelog. and removed improvement for improvements in existing functionality in the changelog. labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants