Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added first of user/lists API methods.

  • Loading branch information...
commit be2b3e96568f41d991d2f1badac4cd4a701f594b 1 parent 34f0344
@catsby catsby authored alexrepty committed
View
4 AppController.m
@@ -175,6 +175,10 @@ - (void)socialGraphInfoReceived:(NSArray *)socialGraphInfo forRequest:(NSString
NSLog(@"Got social graph results for %@:\r%@", connectionIdentifier, socialGraphInfo);
}
+- (void)userListsReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier
+{
+ NSLog(@"Got user lists for %@:\r%@", connectionIdentifier, userInfo);
+}
- (void)imageReceived:(NSImage *)image forRequest:(NSString *)connectionIdentifier
{
View
2  MGTwitterEngine.h
@@ -132,6 +132,8 @@
- (NSString *)getUserInformationForEmail:(NSString *)email; // users/show
+// List Methods
+- (NSString *)getListsForUser:(NSString *)username;
// Direct Message methods
View
23 MGTwitterEngine.m
@@ -44,6 +44,7 @@
#import "MGTwitterMessagesParser.h"
#import "MGTwitterMiscParser.h"
#import "MGTwitterSocialGraphParser.h"
+ #import "MGTwitterUserListsParser.h"
#endif
#endif
@@ -851,6 +852,13 @@ - (void)_parseDataForConnection:(MGTwitterHTTPURLConnection *)connection
connectionIdentifier:identifier requestType:requestType
responseType:responseType];
break;
+ case MGTwitterUserLists:
+ NSLog(@"response type: %d", responseType);
+ [MGTwitterUserListsParser parserWithXML:xmlData delegate:self
+ connectionIdentifier:identifier requestType:requestType
+ responseType:responseType];
+ break;
+
case MGTwitterSocialGraph:
[MGTwitterSocialGraphParser parserWithXML:xmlData delegate:self
connectionIdentifier:identifier requestType:requestType
@@ -880,6 +888,7 @@ - (void)parsingSucceededForRequest:(NSString *)identifier
withParsedObjects:(NSArray *)parsedObjects
{
// Forward appropriate message to _delegate, depending on responseType.
+ NSLog(@"here at parsingSucceededForRequest");
switch (responseType) {
case MGTwitterStatuses:
case MGTwitterStatus:
@@ -910,6 +919,10 @@ - (void)parsingSucceededForRequest:(NSString *)identifier
if ([self _isValidDelegateForSelector:@selector(socialGraphInfoReceived:forRequest:)])
[_delegate socialGraphInfoReceived: parsedObjects forRequest:identifier];
break;
+ case MGTwitterUserLists:
+ if ([self _isValidDelegateForSelector:@selector(userListsReceived:forRequest:)])
+ [_delegate userListsReceived: parsedObjects forRequest:identifier];
+ break;
case MGTwitterOAuthTokenRequest:
if ([self _isValidDelegateForSelector:@selector(accessTokenReceived:forRequest:)] && [parsedObjects count] > 0)
[_delegate accessTokenReceived:[parsedObjects objectAtIndex:0]
@@ -1522,6 +1535,16 @@ - (NSString *)deleteDirectMessage:(MGTwitterEngineID)updateID
responseType:MGTwitterDirectMessage];
}
+#pragma mark Lists
+
+- (NSString *)getListsForUser:(NSString *)username
+{
+ NSString *path = [NSString stringWithFormat:@"%@/lists.%@", username, API_FORMAT];
+
+ return [self _sendRequestWithMethod:nil path:path queryParameters:nil body:nil
+ requestType:MGTwitterUserListsRequest
+ responseType:MGTwitterUserLists];
+}
#pragma mark Friendship methods
View
6 MGTwitterEngine.xcodeproj/project.pbxproj
@@ -71,6 +71,7 @@
C9FEB12C0D6095AF009AA322 /* MGTwitterStatusesParser.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FEB12B0D6095AF009AA322 /* MGTwitterStatusesParser.m */; };
D47CF9B511541D0A00E07931 /* MGTwitterSocialGraphParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D47CF9B411541D0A00E07931 /* MGTwitterSocialGraphParser.m */; };
D47CFCA9115567ED00E07931 /* MGTwitterSocialGraphLibXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D47CFCA8115567ED00E07931 /* MGTwitterSocialGraphLibXMLParser.m */; };
+ F4763D2A11C1837300A35E7E /* MGTwitterUserListsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F4763D2911C1837300A35E7E /* MGTwitterUserListsParser.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -212,6 +213,8 @@
D47CF9B411541D0A00E07931 /* MGTwitterSocialGraphParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGTwitterSocialGraphParser.m; sourceTree = "<group>"; };
D47CFCA7115567ED00E07931 /* MGTwitterSocialGraphLibXMLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGTwitterSocialGraphLibXMLParser.h; sourceTree = "<group>"; };
D47CFCA8115567ED00E07931 /* MGTwitterSocialGraphLibXMLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGTwitterSocialGraphLibXMLParser.m; sourceTree = "<group>"; };
+ F4763D2811C1837300A35E7E /* MGTwitterUserListsParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGTwitterUserListsParser.h; sourceTree = "<group>"; };
+ F4763D2911C1837300A35E7E /* MGTwitterUserListsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGTwitterUserListsParser.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -504,6 +507,8 @@
C90F74CB0D6A3B5300F602A5 /* Twitter NSXML Parsers */ = {
isa = PBXGroup;
children = (
+ F4763D2811C1837300A35E7E /* MGTwitterUserListsParser.h */,
+ F4763D2911C1837300A35E7E /* MGTwitterUserListsParser.m */,
C90F74CC0D6A3B7500F602A5 /* MGTwitterXMLParser.h */,
C90F74CD0D6A3B7500F602A5 /* MGTwitterXMLParser.m */,
C9FEB12A0D6095AF009AA322 /* MGTwitterStatusesParser.h */,
@@ -663,6 +668,7 @@
1E798A6D118D077E00DDD6D9 /* CJSONScanner.m in Sources */,
1E798A6E118D077E00DDD6D9 /* CJSONSerializer.m in Sources */,
1E798A6F118D077E00DDD6D9 /* CSerializedJSONData.m in Sources */,
+ F4763D2A11C1837300A35E7E /* MGTwitterUserListsParser.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
1  MGTwitterEngineDelegate.h
@@ -41,6 +41,7 @@ typedef enum _MGTwitterEngineDeliveryOptions {
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier;
- (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier;
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier;
+- (void)userListsReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier;
- (void)miscInfoReceived:(NSArray *)miscInfo forRequest:(NSString *)connectionIdentifier;
#if YAJL_AVAILABLE || TOUCHJSON_AVAILABLE
- (void)searchResultsReceived:(NSArray *)searchResults forRequest:(NSString *)connectionIdentifier;
Please sign in to comment.
Something went wrong with that request. Please try again.