From fd1806abedf9245b5783f0f9ced954a54bb9fbe1 Mon Sep 17 00:00:00 2001 From: Nicolas Lopes Date: Tue, 1 Oct 2024 15:47:32 -0300 Subject: [PATCH] feat: add latest activity field on session --- session.go | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/session.go b/session.go index 143873b9..a61a1f1c 100644 --- a/session.go +++ b/session.go @@ -2,20 +2,33 @@ package clerk import "encoding/json" +type SessionActivity struct { + Object string `json:"object"` + ID string `json:"id"` + DeviceType *string `json:"device_type,omitempty"` + IsMobile bool `json:"is_mobile"` + BrowserName *string `json:"browser_name,omitempty"` + BrowserVersion *string `json:"browser_version,omitempty"` + IPAddress *string `json:"ip_address,omitempty"` + City *string `json:"city,omitempty"` + Country *string `json:"country,omitempty"` +} + type Session struct { APIResource - Object string `json:"object"` - ID string `json:"id"` - ClientID string `json:"client_id"` - UserID string `json:"user_id"` - Status string `json:"status"` - LastActiveOrganizationID string `json:"last_active_organization_id,omitempty"` - Actor json.RawMessage `json:"actor,omitempty"` - LastActiveAt int64 `json:"last_active_at"` - ExpireAt int64 `json:"expire_at"` - AbandonAt int64 `json:"abandon_at"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + Object string `json:"object"` + ID string `json:"id"` + ClientID string `json:"client_id"` + UserID string `json:"user_id"` + Status string `json:"status"` + LastActiveOrganizationID string `json:"last_active_organization_id,omitempty"` + LatestActivity *SessionActivity `json:"latest_activity,omitempty"` + Actor json.RawMessage `json:"actor,omitempty"` + LastActiveAt int64 `json:"last_active_at"` + ExpireAt int64 `json:"expire_at"` + AbandonAt int64 `json:"abandon_at"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` } type SessionList struct {