From 12013e40bc784668fe9bcab8e57cb7593390ca04 Mon Sep 17 00:00:00 2001 From: cprivite Date: Fri, 19 Nov 2021 15:58:25 -0600 Subject: [PATCH 1/4] Create the UserLite struct. Signed-off-by: cprivite --- user.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/user.go b/user.go index 659da95d..acfedc9e 100644 --- a/user.go +++ b/user.go @@ -68,6 +68,21 @@ type User struct { Staff bool `json:"staff,omitempty"` } +// UserLite is an abbreviated listing of an Equinix Metal user +type UserLite struct { + ID string `json:"id"` + ShortID string `json:"short_id"` + FirstName string `json:"first_name,omitempty"` + LastName string `json:"last_name,omitempty"` + FullName string `json:"full_name,omitempty"` + Email string `json:"email,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Level string `json:"level,omitempty"` + AvatarThumbURL string `json:"avatar_thumb_url,omitempty"` + URL string `json:"href,omitempty"` +} + // UserUpdateRequest struct for UserService.Update type UserUpdateRequest struct { FirstName *string `json:"first_name,omitempty"` From a7b65959e05608c27fa3510571cbc79ad7d5c7b7 Mon Sep 17 00:00:00 2001 From: cprivite Date: Fri, 19 Nov 2021 16:00:35 -0600 Subject: [PATCH 2/4] Add CreatedBy field to the Device struct that uses UserLite. Signed-off-by: cprivite --- devices.go | 1 + 1 file changed, 1 insertion(+) diff --git a/devices.go b/devices.go index 58ebf941..043a6ff0 100644 --- a/devices.go +++ b/devices.go @@ -49,6 +49,7 @@ type Device struct { Description *string `json:"description,omitempty"` State string `json:"state,omitempty"` Created string `json:"created_at,omitempty"` + CreatedBy *UserLite `json:"created_by,omitempty"` Updated string `json:"updated_at,omitempty"` Locked bool `json:"locked,omitempty"` BillingCycle string `json:"billing_cycle,omitempty"` From 6710c5d84803070435074877d1298072ab5181fc Mon Sep 17 00:00:00 2001 From: Chris Privitere Date: Mon, 22 Nov 2021 11:00:27 -0600 Subject: [PATCH 3/4] Use href type instead of pulling url into a string. Co-authored-by: Marques Johansson Signed-off-by: cprivite --- user.go | 1 + 1 file changed, 1 insertion(+) diff --git a/user.go b/user.go index acfedc9e..f55ca63f 100644 --- a/user.go +++ b/user.go @@ -70,6 +70,7 @@ type User struct { // UserLite is an abbreviated listing of an Equinix Metal user type UserLite struct { + *Href `json:",inline"` ID string `json:"id"` ShortID string `json:"short_id"` FirstName string `json:"first_name,omitempty"` From 2908145db3f3206cced2669b701ff5461ceaf9c7 Mon Sep 17 00:00:00 2001 From: cprivite Date: Tue, 23 Nov 2021 14:39:03 -0600 Subject: [PATCH 4/4] Remove URL field and improve formatting of *Href line. Signed-off-by: cprivite --- user.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user.go b/user.go index f55ca63f..3d8ae832 100644 --- a/user.go +++ b/user.go @@ -70,7 +70,7 @@ type User struct { // UserLite is an abbreviated listing of an Equinix Metal user type UserLite struct { - *Href `json:",inline"` + *Href `json:",inline"` ID string `json:"id"` ShortID string `json:"short_id"` FirstName string `json:"first_name,omitempty"` @@ -81,7 +81,6 @@ type UserLite struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` Level string `json:"level,omitempty"` AvatarThumbURL string `json:"avatar_thumb_url,omitempty"` - URL string `json:"href,omitempty"` } // UserUpdateRequest struct for UserService.Update