From 5b8be471aadfbc9cf1aac930aad566a756af7c6b Mon Sep 17 00:00:00 2001 From: danieloliveira085 Date: Mon, 24 May 2021 22:54:47 -0300 Subject: [PATCH] Change field requirements --- client/inputMapper.go | 14 -------------- client/types.go | 18 +++++++++--------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/client/inputMapper.go b/client/inputMapper.go index b89adc5..513b8a3 100644 --- a/client/inputMapper.go +++ b/client/inputMapper.go @@ -65,20 +65,6 @@ type Secrets struct { } func mapActivity(activity *Activity) *PayloadActivity { - // Replace empty fields by "none" - if activity.LargeImage == "" { - activity.LargeImage = "none" - } - if activity.LargeText == "" { - activity.LargeText = "none" - } - if activity.SmallImage == "" { - activity.SmallImage = "none" - } - if activity.SmallText == "" { - activity.SmallText = "none" - } - final := &PayloadActivity{ Details: activity.Details, State: activity.State, diff --git a/client/types.go b/client/types.go index a0b60aa..c32795c 100644 --- a/client/types.go +++ b/client/types.go @@ -17,9 +17,9 @@ type Args struct { } type PayloadActivity struct { - Details string `json:"details"` - State string `json:"state"` - Assets PayloadAssets `json:"assets"` + Details string `json:"details,omitempty"` + State string `json:"state,omitempty"` + Assets PayloadAssets `json:"assets,omitempty"` Party *PayloadParty `json:"party,omitempty"` Timestamps *PayloadTimestamps `json:"timestamps,omitempty"` Secrets *PayloadSecrets `json:"secrets,omitempty"` @@ -27,15 +27,15 @@ type PayloadActivity struct { } type PayloadAssets struct { - LargeImage string `json:"large_image"` - LargeText string `json:"large_text"` - SmallImage string `json:"small_image"` - SmallText string `json:"small_text"` + LargeImage string `json:"large_image,omitempty"` + LargeText string `json:"large_text,omitempty"` + SmallImage string `json:"small_image,omitempty"` + SmallText string `json:"small_text,omitempty"` } type PayloadParty struct { - ID string `json:"id"` - Size [2]int `json:"size"` + ID string `json:"id,omitempty"` + Size [2]int `json:"size,omitempty"` } type PayloadTimestamps struct {