#import "CreateTaskAction.h" NS_ASSUME_NONNULL_BEGIN @implementation CreateTaskAction - (QSObject *)createTask:(QSObject *)directObject { NSString *contents = [directObject displayName]; if (contents) { NSDictionary *parameters = [TextParsingHelper parseText: contents]; [ThingsHelper callRoute:ThingsURLRouteAdd withParameters:parameters]; } else { NSLog(@"Could not get the text of the Things object."); } return directObject; } - (QSObject *)createTask:(QSObject *)directObject in:(QSObject *)indirectObject { NSString *contents = [directObject displayName]; NSDictionary *indirectContents = [indirectObject objectForType:indirectObject.primaryType]; NSString *listId = nil; if (indirectContents) { listId = [indirectContents objectForKey:@"uuid"]; } else { NSLog(@"Could not read the contents for the indirect object"); } if (contents) { NSMutableDictionary *parameters = [TextParsingHelper parseText: contents]; if (listId) { [parameters setObject:listId forKey:@"list-id"]; } else { NSLog(@"Could not find a list id"); } [ThingsHelper callRoute:ThingsURLRouteAdd withParameters:parameters]; } else { NSLog(@"Could not get the text of the Things object."); } return directObject; } @end NS_ASSUME_NONNULL_END