Skip to content

Commit

Permalink
Completed receiver struct as needed and added delete push call
Browse files Browse the repository at this point in the history
  • Loading branch information
kariudo committed Feb 10, 2015
1 parent ecf1567 commit 4571566
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion gopushbullet.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ type PushMessage struct {
SourceDeviceID string `json:"source_device_iden"`

// Properties for response messages
// TODO add these properties
Created float32 `json:"created"`
Modified float32 `json:"modified"`
Active bool `json:"active"`
Dismissed bool `json:"dismissed"`
SenderID string `json:"sender_iden"`
SenderEmail string `json:"sender_email"`
SenderEmailNormalized string `json:"sender_email_normalized"`
ReceiverID string `json:"receiver_iden"`
ReceiverEmail string `json:"receiver_email"`
ReceiverEmailNormalized string `json:"receiver_email_normalized"`
}

//PushList describes a list of push messages
Expand Down Expand Up @@ -545,6 +554,16 @@ func (c *Client) GetPushHistory(modifiedAfter float32) ([]PushMessage, error) {
return pushList.Pushes, nil
}

//DeletePush deletes a push message
func (c *Client) DeletePush(pushID string) error {
_, apiError, err := c.makeCall("DELETE", "pushes/"+pushID, nil)
if err != nil {
log.Println("Failed to delete push: ", apiError, err)
return err
}
return nil
}

func (c *Client) makeCall(method string, call string, data interface{}) (responseBody []byte, apiError *Error, err error) {
// make sure API key seems OK
if len(c.APIKey) == 0 {
Expand Down

0 comments on commit 4571566

Please sign in to comment.