From e4418a03c897cde5f475ea4c8fa0c535774e7692 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:21:33 +0000 Subject: [PATCH] feat: add trial_end_timestamp field to UserInfo and display in status The SimpleLogin API now returns trial_end_timestamp (Unix timestamp or null) in GET /api/user_info. Update the UserInfo struct to capture this field, include it in JSON output, and display a human-readable trial end date in the table output when the user is in trial. Closes #65 Co-Authored-By: Claude Sonnet 4.6 --- cmd/auth/status.go | 7 +++++++ internal/api/client.go | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/auth/status.go b/cmd/auth/status.go index 331434a..cdcfac8 100644 --- a/cmd/auth/status.go +++ b/cmd/auth/status.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "os" + "time" "github.com/mexcool/simplelogin-cli/internal/api" intauth "github.com/mexcool/simplelogin-cli/internal/auth" @@ -70,6 +71,7 @@ func runStatus(cmd *cobra.Command, args []string) error { data["email"] = info.Email data["is_premium"] = info.IsPremium data["in_trial"] = info.InTrial + data["trial_end_timestamp"] = info.TrialEndTimestamp data["key_source"] = source data["key"] = intauth.MaskKey(key) data["api_url"] = apiBase @@ -91,5 +93,10 @@ func runStatus(cmd *cobra.Command, args []string) error { } fmt.Fprintf(os.Stderr, "Premium: %s\n", premium) + if info.InTrial && info.TrialEndTimestamp != nil { + trialEnd := time.Unix(*info.TrialEndTimestamp, 0).UTC().Format("2006-01-02") + fmt.Fprintf(os.Stderr, "Trial ends: %s\n", trialEnd) + } + return nil } diff --git a/internal/api/client.go b/internal/api/client.go index aedc925..7f3dd51 100644 --- a/internal/api/client.go +++ b/internal/api/client.go @@ -174,12 +174,13 @@ func HandleError(statusCode int, body []byte, action string) error { // UserInfo represents user information. type UserInfo struct { - Name string `json:"name"` - Email string `json:"email"` - IsPremium bool `json:"is_premium"` - InTrial bool `json:"in_trial"` - ProfilePicURL string `json:"profile_picture_url"` - MaxAliasFreePlan int `json:"max_alias_free_plan"` + Name string `json:"name"` + Email string `json:"email"` + IsPremium bool `json:"is_premium"` + InTrial bool `json:"in_trial"` + TrialEndTimestamp *int64 `json:"trial_end_timestamp"` + ProfilePicURL string `json:"profile_picture_url"` + MaxAliasFreePlan int `json:"max_alias_free_plan"` } // GetUserInfo retrieves the current user's information.