From 6ed9a799f4b2ed6651cafaf9da7c7db89a2dff71 Mon Sep 17 00:00:00 2001 From: Hunter Horsman Date: Thu, 5 Feb 2015 20:20:38 -0500 Subject: [PATCH] Add get channel info call --- gopushbullet.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gopushbullet.go b/gopushbullet.go index a154241..c773f7f 100644 --- a/gopushbullet.go +++ b/gopushbullet.go @@ -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 { @@ -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 {