Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added method to update an existing list with the listID

  • Loading branch information...
commit 1ffd92e65b1189bda56bdb1ff1561342efcfa0b2 1 parent 5d4b723
@catsby catsby authored alexrepty committed
Showing with 30 additions and 0 deletions.
  1. +3 −0  MGTwitterEngine.h
  2. +27 −0 MGTwitterEngine.m
View
3  MGTwitterEngine.h
@@ -145,6 +145,9 @@
// description - The description to give the list.
- (NSString *)createListForUser:(NSString *)username withName:(NSString *)listName withOptions:(NSDictionary *)options;
+// update an existing list
+- (NSString *)updateListForUser:(NSString *)username withID:(MGTwitterEngineID)listID withOptions:(NSDictionary *)options;
+
// Direct Message methods
- (NSString *)getDirectMessagesSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)pageNum; // direct_messages
View
27 MGTwitterEngine.m
@@ -1584,6 +1584,33 @@ - (NSString *)createListForUser:(NSString *)username withName:(NSString *)listNa
responseType:MGTwitterUserLists];
}
+- (NSString *)updateListForUser:(NSString *)username withID:(MGTwitterEngineID)listID withOptions:(NSDictionary *)options
+{
+ if (!username || !listID) {
+ NSLog(@"returning nil");
+ return nil;
+ }
+ NSString *path = [NSString stringWithFormat:@"%@/lists/%llu.%@", username, listID, API_FORMAT];
+
+ NSMutableDictionary *queryParameters = [NSMutableDictionary dictionaryWithCapacity:0];
+ if ([options objectForKey:@"name"]) {
+ [queryParameters setObject:[options objectForKey:@"name"] forKey:@"name"];
+ }
+ if ([options objectForKey:@"mode"]) {
+ [queryParameters setObject:[options objectForKey:@"mode"] forKey:@"mode"];
+ }
+ if ([options objectForKey:@"description"]) {
+ [queryParameters setObject:[options objectForKey:@"description"] forKey:@"description"];
+ }
+
+ NSString *body = [self _queryStringWithBase:nil parameters:queryParameters prefixed:NO];
+
+ return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path
+ queryParameters:queryParameters body:body
+ requestType:MGTwitterUserListCreate
+ responseType:MGTwitterUserLists];
+}
+
#pragma mark Friendship methods
Please sign in to comment.
Something went wrong with that request. Please try again.