Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change field requirements #30

Merged
merged 1 commit into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions client/inputMapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ 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"`
Buttons []*PayloadButton `json:"buttons,omitempty"`
}

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 {
Expand Down