Skip to content

Commit

Permalink
IconData refact
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed Apr 20, 2021
1 parent 0006058 commit 0de0e6c
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions icon_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ type SingleIcon struct {
Height int `json:"height"`
}

// Icon data. Contains sm+lg (for uploaded image) OR stub+letters+color (for icon generated from display name)
// Icon data. For icon generated from display name contains Letters + Color fields.
type IconData struct {
// Small icon
Sm *SingleIcon `json:"sm,omitempty"`
Sm SingleIcon `json:"sm"`

// Large image
Lg *SingleIcon `json:"lg,omitempty"`
Lg SingleIcon `json:"lg"`

// Generated image with 1-2 letters
Stub string `json:"stub,omitempty"`

// Letters from stub icon
// Letters (only for stub icon)
Letters string `json:"letters,omitempty"`

// Stub icon background color
// Icon background color (only for stub icon)
Color string `json:"color,omitempty"`
}

func (d *IconData) SmUrlOrStub() string {
if d.Sm != nil {
return d.Sm.Url
}
return d.Stub
// Compact representation of a placeholder for an image (experimental)
Blurhash string `json:"blurhash,omitempty"`

// Deprecated
Stub string `json:"stub,omitempty"`
}

0 comments on commit 0de0e6c

Please sign in to comment.