File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,17 @@ const (
1717	UserTypeDefault  UserType  =  "default" 
1818)
1919
20+ // LastLogin represents a LastLogin object 
21+ type  LastLogin  struct  {
22+ 	LoginDatetime  * time.Time  `json:"-"` 
23+ 	Status         string      `json:"status"` 
24+ }
25+ 
2026// User represents a User object 
2127type  User  struct  {
2228	Username             string      `json:"username"` 
2329	Email                string      `json:"email"` 
30+ 	LastLogin            * LastLogin  `json:"last_login"` 
2431	UserType             UserType    `json:"user_type"` 
2532	Restricted           bool        `json:"restricted"` 
2633	TFAEnabled           bool        `json:"tfa_enabled"` 
@@ -42,6 +49,26 @@ type UserUpdateOptions struct {
4249	Restricted  * bool   `json:"restricted,omitempty"` 
4350}
4451
52+ // UnmarshalJSON implements the json.Unmarshaler interface 
53+ func  (ll  * LastLogin ) UnmarshalJSON (b  []byte ) error  {
54+ 	type  Mask  LastLogin 
55+ 
56+ 	p  :=  struct  {
57+ 		* Mask 
58+ 		LoginDatetime  * parseabletime.ParseableTime  `json:"login_datetime"` 
59+ 	}{
60+ 		Mask : (* Mask )(ll ),
61+ 	}
62+ 
63+ 	if  err  :=  json .Unmarshal (b , & p ); err  !=  nil  {
64+ 		return  err 
65+ 	}
66+ 
67+ 	ll .LoginDatetime  =  (* time .Time )(p .LoginDatetime )
68+ 
69+ 	return  nil 
70+ }
71+ 
4572// UnmarshalJSON implements the json.Unmarshaler interface 
4673func  (i  * User ) UnmarshalJSON (b  []byte ) error  {
4774	type  Mask  User 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments