From 6a2d4b105b6d69101e70275ca3c4054e94a4195c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Sun, 30 May 2021 01:36:53 +0200 Subject: [PATCH] api: Remove short struct versions --- api/api.go | 8 ++------ api/builds.go | 16 ++++++++-------- api/meta.go | 26 +++++++++++++------------- api/paste.go | 8 ++++---- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/api/api.go b/api/api.go index e2bed13..a8f02be 100644 --- a/api/api.go +++ b/api/api.go @@ -13,13 +13,9 @@ import ( "git.xenrox.net/~xenrox/srhtctl/helpers" ) -type shortUserStruct struct { - CName string `json:"canonical_name"` - Name string `json:"name"` -} - type userStruct struct { - shortUserStruct + CName string `json:"canonical_name"` + Name string `json:"name"` Email string `json:"email"` URL *string `json:"url"` Location *string `json:"location"` diff --git a/api/builds.go b/api/builds.go index fd0066e..9420be1 100644 --- a/api/builds.go +++ b/api/builds.go @@ -27,14 +27,14 @@ type taskStruct struct { } type buildStruct struct { - ID int `json:"id"` - Status string `json:"status"` - SetupLog string `json:"setup_log"` - Tasks []taskStruct `json:"tasks"` - Note string `json:"note"` - Tags *string `json:"tags"` - Runner *string `json:"runner"` - Owner shortUserStruct `json:"owner"` + ID int `json:"id"` + Status string `json:"status"` + SetupLog string `json:"setup_log"` + Tasks []taskStruct `json:"tasks"` + Note string `json:"note"` + Tags *string `json:"tags"` + Runner *string `json:"runner"` + Owner userStruct `json:"owner"` } // BuildNote is a description of a build diff --git a/api/meta.go b/api/meta.go index bda4583..5b4d032 100644 --- a/api/meta.go +++ b/api/meta.go @@ -26,22 +26,22 @@ type metaAuditPagination struct { } type sshKeyStruct struct { - ID int `json:"id"` - Authorized time.Time `json:"authorized"` - Comment string `json:"comment"` - Fingerprint string `json:"fingerprint"` - Key string `json:"key"` - Owner shortUserStruct `json:"owner"` - LastUsed time.Time `json:"last_used"` + ID int `json:"id"` + Authorized time.Time `json:"authorized"` + Comment string `json:"comment"` + Fingerprint string `json:"fingerprint"` + Key string `json:"key"` + Owner userStruct `json:"owner"` + LastUsed time.Time `json:"last_used"` } type pgpKeyStruct struct { - ID int `json:"id"` - Key string `json:"key"` - KeyID string `json:"key_id"` - Email string `json:"email"` - Authorized time.Time `json:"authorized"` - Owner shortUserStruct `json:"owner"` + ID int `json:"id"` + Key string `json:"key"` + KeyID string `json:"key_id"` + Email string `json:"email"` + Authorized time.Time `json:"authorized"` + Owner userStruct `json:"owner"` } // MetaEdit If true, then edit own profile information diff --git a/api/paste.go b/api/paste.go index 6b7e9c6..881894d 100644 --- a/api/paste.go +++ b/api/paste.go @@ -16,10 +16,10 @@ import ( ) type pasteStruct struct { - Created string `json:"created"` - Visibility string `json:"visibilty"` - SHA string `json:"sha"` - User shortUserStruct `json:"user"` + Created string `json:"created"` + Visibility string `json:"visibilty"` + SHA string `json:"sha"` + User userStruct `json:"user"` Files []struct { Filename string `json:"filename"` BlobID string `json:"blob_id"` -- 2.44.0