Skip to content

Commit

Permalink
Implement GET /statuses/lookup
Browse files Browse the repository at this point in the history
* The twitter api methond GET statuses/lookup was not suppirted in the library,
* we added the functionality with a funciton in tweets.go called: GetTweetsLookupByIds
that returns a slice of tweets, made by wouterbeets & whinette

Signed-off-by: aditya <dev@chimeracoder.net>
  • Loading branch information
Wouter authored and ChimeraCoder committed Dec 24, 2014
1 parent 38af19f commit f4b846c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tweets.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ func (a TwitterApi) GetTweet(id int64, v url.Values) (tweet Tweet, err error) {
return tweet, (<-response_ch).err
}

func (a TwitterApi) GetTweetsLookupByIds(ids []int64, v url.Values) (tweet []Tweet, err error) {
var pids string
for w, i := range ids {
//pids += strconv.Itoa(i)
pids += strconv.FormatInt(i, 10)
if w != len(ids)-1 {
pids += ","
}
}
v = cleanValues(v)
v.Set("id", pids)
response_ch := make(chan response)
a.queryQueue <- query{BaseUrl + "/statuses/lookup.json", v, &tweet, _GET, response_ch}
return tweet, (<-response_ch).err
}

func (a TwitterApi) GetRetweets(id int64, v url.Values) (tweets []Tweet, err error) {
response_ch := make(chan response)
a.queryQueue <- query{BaseUrl + fmt.Sprintf("/statuses/retweets/%d.json", id), v, &tweets, _GET, response_ch}
Expand Down

0 comments on commit f4b846c

Please sign in to comment.