Skip to content

Commit

Permalink
monospace messages
Browse files Browse the repository at this point in the history
  • Loading branch information
svanas authored and gregdel committed May 10, 2021
1 parent f84e8ff commit 0453509
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Message struct {
DeviceName string
Sound string
HTML bool
Monospace bool

// attachment
attachment io.Reader
Expand Down Expand Up @@ -153,6 +154,10 @@ func (m *Message) toMap(pToken, rToken string) map[string]string {
ret["html"] = "1"
}

if m.Monospace {
ret["monospace"] = "1"
}

if m.Priority == PriorityEmergency {
ret["retry"] = strconv.FormatFloat(m.Retry.Seconds(), 'f', -1, 64)
ret["expire"] = strconv.FormatFloat(m.Expire.Seconds(), 'f', -1, 64)
Expand Down
4 changes: 2 additions & 2 deletions pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var APIEndpoint = "https://api.pushover.net/1"

// Pushover custom errors.
var (
ErrHTTPPushover = errors.New("pushover: http error")
ErrEmptyToken = errors.New("pushover: empty API token")
ErrHTTPPushover = errors.New("pushover: http error")
ErrEmptyToken = errors.New("pushover: empty API token")
ErrEmptyURL = errors.New("pushover: empty URL, URLTitle needs an URL")
ErrEmptyRecipientToken = errors.New("pushover: empty recipient token")
ErrInvalidRecipientToken = errors.New("pushover: invalid recipient token")
Expand Down
2 changes: 2 additions & 0 deletions pushover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestEncodeRequest(t *testing.T) {
CallbackURL: "http://yourapp.com/callback",
Sound: SoundCosmic,
HTML: true,
Monospace: true,
}

// Expected arguments
Expand All @@ -71,6 +72,7 @@ func TestEncodeRequest(t *testing.T) {
"callback": "http://yourapp.com/callback",
"sound": "cosmic",
"html": "1",
"monospace": "1",
}

// Encode request
Expand Down

0 comments on commit 0453509

Please sign in to comment.