Skip to content

Commit

Permalink
Added getRetweetsForID method.
Browse files Browse the repository at this point in the history
If the status has no retweets it finishes successfully but with an empty array.
  • Loading branch information
Ben Pearson committed Dec 14, 2010
1 parent aea215d commit fa7fe25
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MGTwitterEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
- (NSString *)getRepliesSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)pageNum count:(int)count; // statuses/mentions
- (NSString *)getRepliesSinceID:(MGTwitterEngineID)sinceID withMaximumID:(MGTwitterEngineID)maxID startingAtPage:(int)pageNum count:(int)count; // statuses/mentions

- (NSString *)getRetweetsForID:(MGTwitterEngineID)updateID;
- (NSString *)getRetweetsForID:(MGTwitterEngineID)updateID startingAtPage:(int)page count:(int)count;

- (NSString *)deleteUpdate:(MGTwitterEngineID)updateID; // statuses/destroy

- (NSString *)getFeaturedUsers; // statuses/features (undocumented, returns invalid JSON data)
Expand Down
25 changes: 25 additions & 0 deletions MGTwitterEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,31 @@ - (NSString *)getRepliesSinceID:(MGTwitterEngineID)sinceID withMaximumID:(MGTwit
responseType:MGTwitterStatuses];
}

#pragma mark -


- (NSString *)getRetweetsForID:(MGTwitterEngineID)updateID
{
return [self getRetweetsForID:updateID startingAtPage:0 count:0]; // zero means default
}

- (NSString *)getRetweetsForID:(MGTwitterEngineID)updateID startingAtPage:(int)page count:(int)count
{
NSString *path = [NSString stringWithFormat:@"statuses/retweets/%llu.%@", updateID, API_FORMAT];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
if (page > 0) {
[params setObject:[NSString stringWithFormat:@"%d", page] forKey:@"page"];
}
if (count > 0) {
[params setObject:[NSString stringWithFormat:@"%d", count] forKey:@"count"];
}

return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil
requestType:MGTwitterRetweetsRequest
responseType:MGTwitterStatuses];
}


#pragma mark -

Expand Down
1 change: 1 addition & 0 deletions MGTwitterRequestTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ typedef enum _MGTwitterRequestType {
MGTwitterUpdateSendRequest, // send a new update for the current user
MGTwitterUpdateDeleteRequest, // delete an update for the current user using the specified id
MGTwitterRepliesRequest, // latest reply status for the current user
MGTwitterRetweetsRequest, // retweets for the specified status id
MGTwitterRetweetSendRequest, // send a new retweet for the current user
MGTwitterFeaturedUsersRequest, // latest status from featured users
MGTwitterFriendUpdatesRequest, // last status for the people that the current user follows
Expand Down

0 comments on commit fa7fe25

Please sign in to comment.