Skip to content

Commit

Permalink
Add get channel info call
Browse files Browse the repository at this point in the history
  • Loading branch information
kariudo committed Feb 6, 2015
1 parent 150f141 commit 6ed9a79
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gopushbullet.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func (c *Client) ListSubscriptions() (subscriptions SubscriptionList, err error)
return
}

//UnsubscribeChannel unsubscibes from the specified channel
//UnsubscribeChannel unsubscribes from the specified channel
func (c *Client) UnsubscribeChannel(channelID string) error {
_, apiError, err := c.makeCall("DELETE", "subscriptions/"+channelID, nil)
if err != nil {
Expand All @@ -456,6 +456,17 @@ func (c *Client) UnsubscribeChannel(channelID string) error {
return nil
}

//ChannelInfo gets detained info for the requested channel
func (c *Client) ChannelInfo(channelTag string) (channel Channel, err error) {
response, apiError, err := c.makeCall("GET", "channel-info?tag="+channelTag, nil)
if err != nil {
log.Println("Failed to get channel info: ", err, apiError.String())
return
}
err = json.Unmarshal(response, &channel)
return
}

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 6ed9a79

Please sign in to comment.