1. Paul Schifferer
  2. Snapper

Commits

Paul Schifferer  committed e1a78bf

Added protocols to various operations to identify the types of query parameters they accept.
Added missing "get my messages" endpoint.
A lot of rejiggering for query parameter processing.
Fixed the erroneous usage of "description" as a property in the update user operation. Bad me.

  • Participants
  • Parent commits 3a79e16
  • Branches master

Comments (0)

Files changed (127)

File Snapper.xcodeproj/project.pbxproj

View file
 		3CDF12E21683C9DF0058CBE0 /* SNPGetStarrersOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDF12E01683C9DE0058CBE0 /* SNPGetStarrersOperation.m */; };
 		3CDF12E31683C9DF0058CBE0 /* SNPGetStarrersOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDF12E01683C9DE0058CBE0 /* SNPGetStarrersOperation.m */; };
 		5B09411A16A378B500D0D1D0 /* SNPBaseImageUpdateOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5B2E458D16A36D88000CCDB6 /* SNPBaseImageUpdateOperation.h */; };
+		5B121AC2171C6F9200C505EA /* SNPCommonParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121AC1171C6F9200C505EA /* SNPCommonParameters.h */; };
+		5B121AC4171C6FA400C505EA /* SNPPaginationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121AC3171C6FA400C505EA /* SNPPaginationParameters.h */; };
+		5B121AC6171C6FB700C505EA /* SNPUserParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121AC5171C6FB700C505EA /* SNPUserParameters.h */; };
+		5B121AC8171C6FC300C505EA /* SNPMessageParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121AC7171C6FC300C505EA /* SNPMessageParameters.h */; };
+		5B121ACA171C6FD000C505EA /* SNPFileParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121AC9171C6FD000C505EA /* SNPFileParameters.h */; };
+		5B121ACC171C6FDE00C505EA /* SNPPostParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121ACB171C6FDE00C505EA /* SNPPostParameters.h */; };
+		5B121ACE171C6FE900C505EA /* SNPChannelParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121ACD171C6FE900C505EA /* SNPChannelParameters.h */; };
+		5B121AD1171C780100C505EA /* SNPGetMyMessagesOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B121ACF171C780000C505EA /* SNPGetMyMessagesOperation.h */; };
+		5B121AD2171C780100C505EA /* SNPGetMyMessagesOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B121AD0171C780100C505EA /* SNPGetMyMessagesOperation.m */; };
+		5B121AD3171C780100C505EA /* SNPGetMyMessagesOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B121AD0171C780100C505EA /* SNPGetMyMessagesOperation.m */; };
 		5B1A40DB168645500030BB30 /* SNPBaseImageFetchOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B1A40D91686454E0030BB30 /* SNPBaseImageFetchOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		5B1A40DC168645500030BB30 /* SNPBaseImageFetchOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B1A40DA1686454F0030BB30 /* SNPBaseImageFetchOperation.m */; };
 		5B1A40DD168645500030BB30 /* SNPBaseImageFetchOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B1A40DA1686454F0030BB30 /* SNPBaseImageFetchOperation.m */; };
 		3CDF12DB1683C9CE0058CBE0 /* SNPGetRepostersOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNPGetRepostersOperation.m; sourceTree = "<group>"; };
 		3CDF12DF1683C9DD0058CBE0 /* SNPGetStarrersOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPGetStarrersOperation.h; sourceTree = "<group>"; };
 		3CDF12E01683C9DE0058CBE0 /* SNPGetStarrersOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNPGetStarrersOperation.m; sourceTree = "<group>"; };
+		5B121AC1171C6F9200C505EA /* SNPCommonParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPCommonParameters.h; sourceTree = "<group>"; };
+		5B121AC3171C6FA400C505EA /* SNPPaginationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPPaginationParameters.h; sourceTree = "<group>"; };
+		5B121AC5171C6FB700C505EA /* SNPUserParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPUserParameters.h; sourceTree = "<group>"; };
+		5B121AC7171C6FC300C505EA /* SNPMessageParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPMessageParameters.h; sourceTree = "<group>"; };
+		5B121AC9171C6FD000C505EA /* SNPFileParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPFileParameters.h; sourceTree = "<group>"; };
+		5B121ACB171C6FDE00C505EA /* SNPPostParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPPostParameters.h; sourceTree = "<group>"; };
+		5B121ACD171C6FE900C505EA /* SNPChannelParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPChannelParameters.h; sourceTree = "<group>"; };
+		5B121ACF171C780000C505EA /* SNPGetMyMessagesOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPGetMyMessagesOperation.h; sourceTree = "<group>"; };
+		5B121AD0171C780100C505EA /* SNPGetMyMessagesOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNPGetMyMessagesOperation.m; sourceTree = "<group>"; };
 		5B1A40D91686454E0030BB30 /* SNPBaseImageFetchOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPBaseImageFetchOperation.h; sourceTree = "<group>"; };
 		5B1A40DA1686454F0030BB30 /* SNPBaseImageFetchOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SNPBaseImageFetchOperation.m; sourceTree = "<group>"; };
 		5B1A40E01686664E0030BB30 /* SNPBaseStreamOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SNPBaseStreamOperation.h; sourceTree = "<group>"; };
 			children = (
 				3C6B5F2E1680EEDE006C63C1 /* Snapper.h */,
 				3C6B5F9016811640006C63C1 /* CWLSynthesizeSingleton.h */,
+				5BD0241416861E5100E24D5A /* SNPConstants.h */,
 				3C6B5F391680F184006C63C1 /* Accounts */,
 				3C6B5F381680F0D6006C63C1 /* Model */,
 				3C6B5F371680F0CF006C63C1 /* Operations */,
 				3CDF12071683B7E30058CBE0 /* Threads */,
 				3C6B5F8516810A2E006C63C1 /* Miscellaneous */,
 				5BE0A54E16817FE8005AA40C /* Categories */,
-				5BD0241416861E5100E24D5A /* SNPConstants.h */,
+				5B121ABE171C6F6D00C505EA /* Protocols */,
 			);
 			path = Shared;
 			sourceTree = "<group>";
 				3CDF12181683B8690058CBE0 /* SNPGetChannelMessagesOperation.m */,
 				3CDF121C1683B8770058CBE0 /* SNPDeleteMessageOperation.h */,
 				3CDF121D1683B8770058CBE0 /* SNPDeleteMessageOperation.m */,
+				5B121ACF171C780000C505EA /* SNPGetMyMessagesOperation.h */,
+				5B121AD0171C780100C505EA /* SNPGetMyMessagesOperation.m */,
 			);
 			name = Messages;
 			sourceTree = "<group>";
 			name = Threads;
 			sourceTree = "<group>";
 		};
+		5B121ABE171C6F6D00C505EA /* Protocols */ = {
+			isa = PBXGroup;
+			children = (
+				5B121ACD171C6FE900C505EA /* SNPChannelParameters.h */,
+				5B121AC1171C6F9200C505EA /* SNPCommonParameters.h */,
+				5B121AC9171C6FD000C505EA /* SNPFileParameters.h */,
+				5B121AC7171C6FC300C505EA /* SNPMessageParameters.h */,
+				5B121AC3171C6FA400C505EA /* SNPPaginationParameters.h */,
+				5B121ACB171C6FDE00C505EA /* SNPPostParameters.h */,
+				5B121AC5171C6FB700C505EA /* SNPUserParameters.h */,
+			);
+			name = Protocols;
+			sourceTree = "<group>";
+		};
 		5B8A333E16B7992900BE5A8A /* Files */ = {
 			isa = PBXGroup;
 			children = (
 				5B6B48EF1687CDF90032C586 /* SNPBaseClientOperation.h in Headers */,
 				5B6B48F41687CEFC0032C586 /* SNPACL.h in Headers */,
 				3CDF12A01683C8CE0058CBE0 /* SNPUpdateUserOperation.h in Headers */,
+				5B121AC2171C6F9200C505EA /* SNPCommonParameters.h in Headers */,
+				5B121AC4171C6FA400C505EA /* SNPPaginationParameters.h in Headers */,
+				5B121AC6171C6FB700C505EA /* SNPUserParameters.h in Headers */,
+				5B121AC8171C6FC300C505EA /* SNPMessageParameters.h in Headers */,
+				5B121ACA171C6FD000C505EA /* SNPFileParameters.h in Headers */,
+				5B121ACC171C6FDE00C505EA /* SNPPostParameters.h in Headers */,
+				5B121ACE171C6FE900C505EA /* SNPChannelParameters.h in Headers */,
+				5B121AD1171C780100C505EA /* SNPGetMyMessagesOperation.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 				5B90EC2F16F185CE00A50BCF /* SNPMuteChannelOperation.m in Sources */,
 				5B90EC3416F185DB00A50BCF /* SNPUnmuteChannelOperation.m in Sources */,
 				5B7B5ABC17026B130018D2AB /* SNPBaseMessageOperation.m in Sources */,
+				5B121AD2171C780100C505EA /* SNPGetMyMessagesOperation.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 				5B90EC3016F185CE00A50BCF /* SNPMuteChannelOperation.m in Sources */,
 				5B90EC3516F185DB00A50BCF /* SNPUnmuteChannelOperation.m in Sources */,
 				5B7B5ABD17026B130018D2AB /* SNPBaseMessageOperation.m in Sources */,
+				5B121AD3171C780100C505EA /* SNPGetMyMessagesOperation.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

File Snapper/Source/Shared/SNPAPIUtils.h

View file
 - (NSURL*)getMessagesEndpointURL;
 - (NSURL*)deleteMessageEndpointURL:(NSInteger)channelId
                          messageId:(NSInteger)messageId;
+- (NSURL*)getMyMessagesEndpointURL;
 
 // -- Stream URL methods --
 - (NSURL*)createStreamEndpointURL;

File Snapper/Source/Shared/SNPAPIUtils.m

View file
                   relativeToURL:_rootAPIURL];
 }
 
+- (NSURL*)getMyMessagesEndpointURL {
+    return [NSURL URLWithString:@"users/me/messages"
+                  relativeToURL:_rootAPIURL];
+}
+
 
 #pragma mark - Stream URL methods
 

File Snapper/Source/Shared/SNPBaseMessageOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPMessageParameters.h"
 
 
 @interface SNPBaseMessageOperation : SNPBaseUserTokenOperation
+<SNPMessageParameters>
 
 // -- Properties --
-@property (nonatomic, copy) NSArray* channelTypes;
-@property (nonatomic, assign) BOOL includeMessageAnnotations;
 
 @end

File Snapper/Source/Shared/SNPBaseMessageOperation.m

View file
 
 @implementation SNPBaseMessageOperation
 
+@synthesize includeMachine = _includeMachine;
+@synthesize includeMuted = _includeMuted;
+@synthesize includeDeleted = _includeDeleted;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+@synthesize channelTypes = _channelTypes;
+
 - (void)main {
 
     NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
         [parameters addEntriesFromDictionary:self.parameters];
     }
 
+    if(_includeMachine) {
+        parameters[@"include_machine"] = @"1";
+    }
+    if(_includeMuted) {
+        parameters[@"include_muted"] = @"1";
+    }
+    if(_includeDeleted) {
+        parameters[@"include_deleted"] = @"1";
+    }
     if(_includeMessageAnnotations) {
-        parameters[@"include_message_annotations"] = @(_includeMessageAnnotations);
+        parameters[@"include_message_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
     }
     if(_channelTypes) {
         parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];

File Snapper/Source/Shared/SNPBaseStreamOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPBaseStreamOperation : SNPBaseUserTokenOperation
+<SNPPaginationParameters>
 
 // -- Properties --
-@property (nonatomic, assign) NSUInteger beforeId;
-@property (nonatomic, assign) NSUInteger sinceId;
-@property (nonatomic, assign) NSInteger count;
-@property (nonatomic, assign) BOOL includePostAnnotations;
-@property (nonatomic, assign) BOOL includeStarredBy;
-@property (nonatomic, assign) BOOL includeReposters;
 
 @end

File Snapper/Source/Shared/SNPBaseStreamOperation.m

View file
 
 @implementation SNPBaseStreamOperation
 
+@synthesize beforeId = _beforeId;
+@synthesize sinceId = _sinceId;
+@synthesize count = _count;
+
 - (void)main {
 
     NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
     if(_count) {
         parameters[@"count"] = @(_count);
     }
-    if(_includePostAnnotations) {
-        parameters[@"include_post_annotations"] = @(_includePostAnnotations);
-    }
-    if(_includeStarredBy) {
-        parameters[@"include_starred_by"] = @(_includeStarredBy);
-    }
-    if(_includeReposters) {
-        parameters[@"include_reposters"] = @(_includeReposters);
-    }
 
     if([[parameters allKeys] count]) {
         self.parameters = parameters;

File Snapper/Source/Shared/SNPBaseUserTokenOperation.h

View file
 // -- Properties --
 @property (nonatomic, copy) NSString* accountId;
 
-@property (nonatomic, assign) BOOL includeMachine;
-@property (nonatomic, assign) BOOL includeMuted;
-@property (nonatomic, assign) BOOL includeDeleted;
-@property (nonatomic, assign) BOOL includeAnnotations;
-@property (nonatomic, assign) BOOL includeUserAnnotations;
-@property (nonatomic, assign) BOOL includeUser;
-@property (nonatomic, assign) BOOL includeDirected;
-
 // -- Initializers --
 - (id)initWithAccountId:(NSString*)accountId
            finishBlock:(void (^)(SNPResponse* response))finishBlock;

File Snapper/Source/Shared/SNPBaseUserTokenOperation.m

View file
     }
 
     // Query parameters
-    [self handleQueryParameters];
-
     NSMutableString* queryParams = [NSMutableString new];
     [self.parameters enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL* stop) {
         if([queryParams length] > 0) {
     }
 }
 
-- (void)handleQueryParameters {
-    
-    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
-
-    if(self.parameters) {
-        [parameters addEntriesFromDictionary:self.parameters];
-    }
-
-    if(_includeAnnotations) {
-        parameters[@"include_annotations"] = @(_includeAnnotations);
-    }
-    if(_includeMachine) {
-        parameters[@"include_machine"] = @(_includeMachine);
-    }
-    if(_includeMuted) {
-        parameters[@"include_muted"] = @(_includeMuted);
-    }
-    if(_includeDeleted) {
-        parameters[@"include_deleted"] = @(_includeDeleted);
-    }
-    if(_includeUserAnnotations) {
-        parameters[@"include_user_annotations"] = @(_includeUserAnnotations);
-    }
-    if(_includeUser) {
-        parameters[@"include_user"] = @(_includeUser);
-    }
-    if(_includeDirected) {
-        parameters[@"include_directed"] = @(_includeDirected);
-    }
-
-    if([[parameters allKeys] count]) {
-        self.parameters = parameters;
-    }
-}
-
 @end

File Snapper/Source/Shared/SNPChannelParameters.h

View file
+//
+//  SNPChannelParameters.h
+//  Snapper
+//
+//  Created by Paul Schifferer on 4/15/13.
+//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "SNPCommonParameters.h"
+
+
+@protocol SNPChannelParameters <SNPCommonParameters>
+
+@required
+@property (nonatomic, copy) NSArray* channelTypes;
+@property (nonatomic, assign) BOOL includeMarker;
+@property (nonatomic, assign) BOOL includeRead;
+@property (nonatomic, assign) BOOL includeRecentMessage;
+@property (nonatomic, assign) BOOL includeMessageAnnotations;
+
+@end

File Snapper/Source/Shared/SNPCommonParameters.h

View file
+//
+//  SNPCommonParameters.h
+//  Snapper
+//
+//  Created by Paul Schifferer on 4/15/13.
+//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@protocol SNPCommonParameters <NSObject>
+
+@required
+@property (nonatomic, assign) BOOL includeAnnotations;
+@property (nonatomic, assign) BOOL includeUserAnnotations;
+
+@end

File Snapper/Source/Shared/SNPCreateChannelOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
-
 #import "SNPACL.h"
+#import "SNPChannelParameters.h"
 
 
 @interface SNPCreateChannelOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters>
 
 // -- Properites --
 @property (nonatomic, copy) NSString* type;

File Snapper/Source/Shared/SNPCreateChannelOperation.m

View file
 
     body[@"type"] = _type;
 
-    // TODO: readers
+    // readers
     body[@"readers"] = [_readers externalRepresentation];
 
-    // TODO: writers
+    // writers
     body[@"writers"] = [_writers externalRepresentation];
 
     NSMutableArray* serializedAnnotations = [NSMutableArray new];
 
     self.method = @"POST";
     self.body = bodyData;
+
+    [self handleChannelParameters];
     
     [super main];
 }
 
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPCreateFileOperation.h

View file
 
 #import "SNPBaseUserTokenOperation.h"
 #import "SNPResponse.h"
+#import "SNPFileParameters.h"
 
 
 @interface SNPCreateFileOperation : SNPBaseUserTokenOperation
+<SNPFileParameters>
 
 // -- Properties --
 @property (nonatomic, copy) NSString* name;

File Snapper/Source/Shared/SNPCreateFileOperation.m

View file
     self.bodyType = [NSString stringWithFormat:@"multipart/form-data; boundary=\"%@\"", boundaryString];
 
     self.serializationRootClass = [SNPFile class];
+
+    [self handleFileParameters];
     
     [super main];
 }
 
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize fileTypes = _fileTypes;
+@synthesize includeIncomplete = _includeIncomplete;
+@synthesize includePrivate = _includePrivate;
+@synthesize includeFileAnnotations = _includeFileAnnotations;
+
+- (void)handleFileParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_fileTypes) {
+        parameters[@"include_annotations"] = [_fileTypes componentsJoinedByString:@","];
+    }
+    if(_includeIncomplete) {
+        parameters[@"include_incomplete"] = @"1";
+    }
+    if(_includePrivate) {
+        parameters[@"include_private"] = @"1";
+    }
+    if(_includeFileAnnotations) {
+        parameters[@"include_file_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPCreateMessageOperation.h

View file
 //  Copyright (c) 2012 Pilgrimage Software. All rights reserved.
 //
 
-#import "SNPBaseUserTokenOperation.h"
+#import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
 
 
-@interface SNPCreateMessageOperation : SNPBaseUserTokenOperation
+@interface SNPCreateMessageOperation : SNPBaseMessageOperation
+<SNPMessageParameters>
 
 // -- Properties --
 /**

File Snapper/Source/Shared/SNPCreateMessageOperation.m

View file
     self.endpoint = [[SNPAPIUtils sharedAPIUtils] createMessageEndpointURL:_channelId];
     self.method = @"POST";
 
-    [self handleQueryParameters];
-
     NSMutableDictionary* postDict = [NSMutableDictionary new];
     if([_text length]) {
         postDict[@"text"] = _text;
     [super main];
 }
 
-- (void)handleQueryParameters {
-
-    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
-
-    if(self.parameters) {
-        [parameters addEntriesFromDictionary:self.parameters];
-    }
-
-    if(_includeMessageAnnotations) {
-        parameters[@"include_message_annotations"] = @(_includeMessageAnnotations);
-    }
-
-    if([[parameters allKeys] count]) {
-        self.parameters = parameters;
-    }
-}
-
 @end

File Snapper/Source/Shared/SNPCreatePostOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPPostParameters.h"
 
 
 @interface SNPCreatePostOperation : SNPBaseUserTokenOperation
+<SNPPostParameters>
 
 // -- Properties --
 /**

File Snapper/Source/Shared/SNPCreatePostOperation.m

View file
 
     self.body = postBody;
     self.bodyType = @"application/json";
+
+    [self handlePostParameters];
     
     [super main];
 }
 
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize includeMuted = _includeMuted;
+@synthesize includeDeleted = _includeDeleted;
+@synthesize includeDirectedPosts = _includeDirectedPosts;
+@synthesize includeMachine = _includeMachine;
+@synthesize includeStarredBy = _includeStarredBy;
+@synthesize includeReposters = _includeReposters;
+@synthesize includePostAnnotations = _includePostAnnotations;
+
+- (void)handlePostParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_includeMuted) {
+        parameters[@"include_muted"] = @"1";
+    }
+    if(_includeDeleted) {
+        parameters[@"include_deleted"] = @"1";
+    }
+    if(_includeDirectedPosts) {
+        parameters[@"include_directed_posts"] = @"1";
+    }
+    if(_includeMachine) {
+        parameters[@"include_machine"] = @"1";
+    }
+    if(_includeStarredBy) {
+        parameters[@"include_starred_by"] = @"1";
+    }
+    if(_includeReposters) {
+        parameters[@"include_reposters"] = @"1";
+    }
+    if(_includePostAnnotations) {
+        parameters[@"include_post_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPDeleteFileOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPFileParameters.h"
 
 
 @interface SNPDeleteFileOperation : SNPBaseUserTokenOperation
+<SNPFileParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSInteger fileId;

File Snapper/Source/Shared/SNPDeleteFileOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleFileParameters];
+
+    [super main];
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize fileTypes = _fileTypes;
+@synthesize includeIncomplete = _includeIncomplete;
+@synthesize includePrivate = _includePrivate;
+@synthesize includeFileAnnotations = _includeFileAnnotations;
+
+- (void)handleFileParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_fileTypes) {
+        parameters[@"include_annotations"] = [_fileTypes componentsJoinedByString:@","];
+    }
+    if(_includeIncomplete) {
+        parameters[@"include_incomplete"] = @"1";
+    }
+    if(_includePrivate) {
+        parameters[@"include_private"] = @"1";
+    }
+    if(_includeFileAnnotations) {
+        parameters[@"include_file_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPDeleteMessageOperation.h

View file
 //  Copyright (c) 2012 Pilgrimage Software. All rights reserved.
 //
 
-#import "SNPBaseUserTokenOperation.h"
+#import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
 
 
-@interface SNPDeleteMessageOperation : SNPBaseUserTokenOperation
+@interface SNPDeleteMessageOperation : SNPBaseMessageOperation
+<SNPMessageParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger messageId;

File Snapper/Source/Shared/SNPDeletePostOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPPostParameters.h"
 
 
 @interface SNPDeletePostOperation : SNPBaseUserTokenOperation
+<SNPPostParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger postId;

File Snapper/Source/Shared/SNPDeletePostOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handlePostParameters];
+
+    [super main];
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize includeMuted = _includeMuted;
+@synthesize includeDeleted = _includeDeleted;
+@synthesize includeDirectedPosts = _includeDirectedPosts;
+@synthesize includeMachine = _includeMachine;
+@synthesize includeStarredBy = _includeStarredBy;
+@synthesize includeReposters = _includeReposters;
+@synthesize includePostAnnotations = _includePostAnnotations;
+
+- (void)handlePostParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_includeMuted) {
+        parameters[@"include_muted"] = @"1";
+    }
+    if(_includeDeleted) {
+        parameters[@"include_deleted"] = @"1";
+    }
+    if(_includeDirectedPosts) {
+        parameters[@"include_directed_posts"] = @"1";
+    }
+    if(_includeMachine) {
+        parameters[@"include_machine"] = @"1";
+    }
+    if(_includeStarredBy) {
+        parameters[@"include_starred_by"] = @"1";
+    }
+    if(_includeReposters) {
+        parameters[@"include_reposters"] = @"1";
+    }
+    if(_includePostAnnotations) {
+        parameters[@"include_post_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPFileParameters.h

View file
+//
+//  SNPFileParameters.h
+//  Snapper
+//
+//  Created by Paul Schifferer on 4/15/13.
+//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "SNPCommonParameters.h"
+
+
+@protocol SNPFileParameters <SNPCommonParameters>
+
+@required
+@property (nonatomic, copy) NSArray* fileTypes;
+@property (nonatomic, assign) BOOL includeIncomplete;
+@property (nonatomic, assign) BOOL includePrivate;
+@property (nonatomic, assign) BOOL includeFileAnnotations;
+
+@end

File Snapper/Source/Shared/SNPFollowUserOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPUserParameters.h"
 
 
 @interface SNPFollowUserOperation : SNPBaseUserTokenOperation
+<SNPUserParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger userId;

File Snapper/Source/Shared/SNPFollowUserOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleCommonParameters];
+
+    [super main];
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+- (void)handleCommonParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetChannelMessagesOperation.h

View file
 //
 
 #import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPGetChannelMessagesOperation : SNPBaseMessageOperation
+<SNPPaginationParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger channelId;

File Snapper/Source/Shared/SNPGetChannelMessagesOperation.m

View file
 
 - (void)main {
 
-    [self handleQueryParameters];
+    [self handlePaginationParameters];
 
     [super main];
 }
 
-- (void)handleQueryParameters {
+- (void)handlePaginationParameters {
 
     NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
 
         [parameters addEntriesFromDictionary:self.parameters];
     }
 
-    if(_beforeId) {
-        parameters[@"before_id"] = @(_beforeId);
+    if(self.beforeId) {
+        parameters[@"before_id"] = @(self.beforeId);
     }
-    if(_sinceId) {
-        parameters[@"since_id"] = @(_sinceId);
+    if(self.sinceId) {
+        parameters[@"since_id"] = @(self.sinceId);
     }
-    if(_count) {
-        parameters[@"count"] = @(_count);
+    if(self.count) {
+        parameters[@"count"] = @(self.count);
     }
 
     if([[parameters allKeys] count]) {

File Snapper/Source/Shared/SNPGetChannelOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPChannelParameters.h"
 
 
 @interface SNPGetChannelOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger channelId;

File Snapper/Source/Shared/SNPGetChannelOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleChannelParameters];
+
+    [super main];
+}
+
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetChannelSubscriberIdsOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPChannelParameters.h"
 
 
 @interface SNPGetChannelSubscriberIdsOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger channelId;

File Snapper/Source/Shared/SNPGetChannelSubscriberIdsOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleChannelParameters];
+
+    [super main];
+}
+
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetChannelSubscribersOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPChannelParameters.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPGetChannelSubscribersOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters, SNPPaginationParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger channelId;

File Snapper/Source/Shared/SNPGetChannelSubscribersOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleChannelParameters];
+
+    [super main];
+}
+
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetChannelsOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPChannelParameters.h"
 
 
 @interface SNPGetChannelsOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters>
 
 // -- Properties --
 @property (nonatomic, retain) NSArray* channelIds;

File Snapper/Source/Shared/SNPGetChannelsOperation.m

View file
 
     self.serializationArrayClass = [SNPChannel class];
 
+    [self handleChannelParameters];
+
     [super main];
 }
 
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetFileOperation.h

View file
 //
 
 #import "SNPBaseFileOperation.h"
+#import "SNPFileParameters.h"
 
 
 @interface SNPGetFileOperation : SNPBaseFileOperation
+<SNPFileParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSInteger fileId;

File Snapper/Source/Shared/SNPGetFileOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleFileParameters];
+
+    [super main];
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize fileTypes = _fileTypes;
+@synthesize includeIncomplete = _includeIncomplete;
+@synthesize includePrivate = _includePrivate;
+@synthesize includeFileAnnotations = _includeFileAnnotations;
+
+- (void)handleFileParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_fileTypes) {
+        parameters[@"include_annotations"] = [_fileTypes componentsJoinedByString:@","];
+    }
+    if(_includeIncomplete) {
+        parameters[@"include_incomplete"] = @"1";
+    }
+    if(_includePrivate) {
+        parameters[@"include_private"] = @"1";
+    }
+    if(_includeFileAnnotations) {
+        parameters[@"include_file_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetFilesOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPFileParameters.h"
 
 
 @interface SNPGetFilesOperation : SNPBaseUserTokenOperation
+<SNPFileParameters>
 
 // -- Properties --
 @property (nonatomic, retain) NSArray* fileIds;

File Snapper/Source/Shared/SNPGetFilesOperation.m

View file
 
     self.serializationArrayClass = [SNPFile class];
 
+    [self handleFileParameters];
+    
     [super main];
 }
 
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize fileTypes = _fileTypes;
+@synthesize includeIncomplete = _includeIncomplete;
+@synthesize includePrivate = _includePrivate;
+@synthesize includeFileAnnotations = _includeFileAnnotations;
+
+- (void)handleFileParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_fileTypes) {
+        parameters[@"include_annotations"] = [_fileTypes componentsJoinedByString:@","];
+    }
+    if(_includeIncomplete) {
+        parameters[@"include_incomplete"] = @"1";
+    }
+    if(_includePrivate) {
+        parameters[@"include_private"] = @"1";
+    }
+    if(_includeFileAnnotations) {
+        parameters[@"include_file_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetGlobalStreamOperation.h

View file
 //
 
 #import "SNPBaseStreamOperation.h"
+#import "SNPPostParameters.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPGetGlobalStreamOperation : SNPBaseStreamOperation
+<SNPPostParameters, SNPPaginationParameters>
 
 @end

File Snapper/Source/Shared/SNPGetGlobalStreamOperation.m

View file
 
     self.endpoint = [[SNPAPIUtils sharedAPIUtils] getGlobalStreamEndpointURL];
     self.serializationArrayClass = [SNPPost class];
-    
+
+    [self handlePostParameters];
+
     [super main];
 }
 
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize includeMuted = _includeMuted;
+@synthesize includeDeleted = _includeDeleted;
+@synthesize includeDirectedPosts = _includeDirectedPosts;
+@synthesize includeMachine = _includeMachine;
+@synthesize includeStarredBy = _includeStarredBy;
+@synthesize includeReposters = _includeReposters;
+@synthesize includePostAnnotations = _includePostAnnotations;
+
+- (void)handlePostParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_includeMuted) {
+        parameters[@"include_muted"] = @"1";
+    }
+    if(_includeDeleted) {
+        parameters[@"include_deleted"] = @"1";
+    }
+    if(_includeDirectedPosts) {
+        parameters[@"include_directed_posts"] = @"1";
+    }
+    if(_includeMachine) {
+        parameters[@"include_machine"] = @"1";
+    }
+    if(_includeStarredBy) {
+        parameters[@"include_starred_by"] = @"1";
+    }
+    if(_includeReposters) {
+        parameters[@"include_reposters"] = @"1";
+    }
+    if(_includePostAnnotations) {
+        parameters[@"include_post_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetMessageOperation.h

View file
 //  Copyright (c) 2012 Pilgrimage Software. All rights reserved.
 //
 
-#import "SNPBaseUserTokenOperation.h"
+#import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
 
 
-@interface SNPGetMessageOperation : SNPBaseUserTokenOperation
+@interface SNPGetMessageOperation : SNPBaseMessageOperation
+<SNPMessageParameters>
 
 // -- Properties --
 @property (nonatomic, assign) NSUInteger messageId;

File Snapper/Source/Shared/SNPGetMessagesOperation.h

View file
 //  Copyright (c) 2012 Pilgrimage Software. All rights reserved.
 //
 
-#import "SNPBaseUserTokenOperation.h"
+#import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
 
 
-@interface SNPGetMessagesOperation : SNPBaseUserTokenOperation
+@interface SNPGetMessagesOperation : SNPBaseMessageOperation
+<SNPMessageParameters>
 
 // -- Properties --
 @property (nonatomic, retain) NSArray* messageIds;

File Snapper/Source/Shared/SNPGetMutedChannelsOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPChannelParameters.h"
 
 
 @interface SNPGetMutedChannelsOperation : SNPBaseUserTokenOperation
+<SNPChannelParameters>
 
 @end

File Snapper/Source/Shared/SNPGetMutedChannelsOperation.m

View file
 
     self.endpoint = [[SNPAPIUtils sharedAPIUtils] getMutedChannelsEndpointURL];
     self.serializationArrayClass = [SNPChannel class];
-    
+
+    [self handleChannelParameters];
+
     [super main];
 }
 
+@synthesize channelTypes = _channelTypes;
+@synthesize includeMarker = _includeMarker;
+@synthesize includeRead = _includeRead;
+@synthesize includeRecentMessage = _includeRecentMessage;
+@synthesize includeMessageAnnotations = _includeMessageAnnotations;
+
+- (void)handleChannelParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_channelTypes) {
+        parameters[@"channel_types"] = [_channelTypes componentsJoinedByString:@","];
+    }
+    if(_includeMarker) {
+        parameters[@"include_marker"] = @"1";
+    }
+    if(_includeRead) {
+        parameters[@"include_read"] = @"1";
+    }
+    if(_includeRecentMessage) {
+        parameters[@"include_recent_message"] = @"1";
+    }
+    if(_includeMessageAnnotations) {
+        parameters[@"include_message_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetMyFilesOperation.h

View file
 //
 
 #import "SNPBaseUserTokenOperation.h"
+#import "SNPFileParameters.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPGetMyFilesOperation : SNPBaseUserTokenOperation
+<SNPFileParameters, SNPPaginationParameters>
 
 // -- Properties --
 

File Snapper/Source/Shared/SNPGetMyFilesOperation.m

View file
     return self;
 }
 
+- (void)main {
+
+    [self handleFileParameters];
+
+    [super main];
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize fileTypes = _fileTypes;
+@synthesize includeIncomplete = _includeIncomplete;
+@synthesize includePrivate = _includePrivate;
+@synthesize includeFileAnnotations = _includeFileAnnotations;
+
+- (void)handleFileParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(_fileTypes) {
+        parameters[@"include_annotations"] = [_fileTypes componentsJoinedByString:@","];
+    }
+    if(_includeIncomplete) {
+        parameters[@"include_incomplete"] = @"1";
+    }
+    if(_includePrivate) {
+        parameters[@"include_private"] = @"1";
+    }
+    if(_includeFileAnnotations) {
+        parameters[@"include_file_annotations"] = @"1";
+    }
+    if(_includeAnnotations) {
+        parameters[@"include_annotations"] = @"1";
+    }
+    if(_includeUserAnnotations) {
+        parameters[@"include_user_annotations"] = @"1";
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
 @end

File Snapper/Source/Shared/SNPGetMyMessagesOperation.h

View file
+//
+//  SNPGetMyMessagesOperation.h
+//  Snapper
+//
+//  Created by Paul Schifferer on 4/15/13.
+//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
+//
+
+#import "SNPBaseMessageOperation.h"
+#import "SNPMessageParameters.h"
+#import "SNPPaginationParameters.h"
+
+
+@interface SNPGetMyMessagesOperation : SNPBaseMessageOperation
+<SNPPaginationParameters>
+
+@end

File Snapper/Source/Shared/SNPGetMyMessagesOperation.m

View file
+//
+//  SNPGetMyMessagesOperation.m
+//  Snapper
+//
+//  Created by Paul Schifferer on 4/15/13.
+//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
+//
+
+#import "SNPGetMyMessagesOperation.h"
+
+#import "SNPMessage.h"
+
+#import "SNPAPIUtils.h"
+
+
+@implementation SNPGetMyMessagesOperation
+
+#pragma mark - Workhorse
+
+- (void)main {
+
+    self.endpoint = [[SNPAPIUtils sharedAPIUtils] getMyMessagesEndpointURL];
+    self.serializationArrayClass = [SNPMessage class];
+
+    [self handlePaginationParameters];
+    
+    [super main];
+}
+
+@synthesize beforeId = _beforeId;
+@synthesize sinceId = _sinceId;
+@synthesize count = _count;
+
+- (void)handlePaginationParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(self.beforeId) {
+        parameters[@"before_id"] = @(self.beforeId);
+    }
+    if(self.sinceId) {
+        parameters[@"since_id"] = @(self.sinceId);
+    }
+    if(self.count) {
+        parameters[@"count"] = @(self.count);
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
+@end

File Snapper/Source/Shared/SNPGetPersonalStreamOperation.h

View file
 //
 
 #import "SNPBaseStreamOperation.h"
+#import "SNPPostParameters.h"
+#import "SNPPaginationParameters.h"
 
 
 @interface SNPGetPersonalStreamOperation : SNPBaseStreamOperation
+<SNPPostParameters, SNPPaginationParameters>
 
 @property (nonatomic, assign) BOOL unified;
 

File Snapper/Source/Shared/SNPGetPersonalStreamOperation.m

View file
     }
     self.serializationArrayClass = [SNPPost class];
 
+    [self handlePaginationParameters];
+    [self handlePostParameters];
+
     [super main];
 }
 
+- (void)handlePaginationParameters {
+
+    NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
+
+    if(self.parameters) {
+        [parameters addEntriesFromDictionary:self.parameters];
+    }
+
+    if(self.beforeId) {
+        parameters[@"before_id"] = @(self.beforeId);
+    }
+    if(self.sinceId) {
+        parameters[@"since_id"] = @(self.sinceId);
+    }
+    if(self.count) {
+        parameters[@"count"] = @(self.count);
+    }
+
+    if([[parameters allKeys] count]) {
+        self.parameters = parameters;
+    }
+}
+
+@synthesize includeAnnotations = _includeAnnotations;
+@synthesize includeUserAnnotations = _includeUserAnnotations;
+
+@synthesize includeMuted = _includeMuted;
+@synthesize includeDeleted = _includeDeleted;
+@synthesize includeDirectedPosts = _includeDirectedPosts;
+@synthesize includeMachine = _includeMachine;
+@synthesize includeStarredBy = _includeStarredBy;
+@synthesize includeReposters = _includeReposters;
+@synthesize includePostAnnotations = _includePostAnnotations;
+
+- (void)handlePostParameters {