aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Helpers/TextParsingHelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'QSThingsPlugin/Helpers/TextParsingHelper.h')
-rw-r--r--QSThingsPlugin/Helpers/TextParsingHelper.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/QSThingsPlugin/Helpers/TextParsingHelper.h b/QSThingsPlugin/Helpers/TextParsingHelper.h
new file mode 100644
index 0000000..2c7029c
--- /dev/null
+++ b/QSThingsPlugin/Helpers/TextParsingHelper.h
@@ -0,0 +1,22 @@
+#import "Constants.h"
+#import <Foundation/Foundation.h>
+#import <Security/Security.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface TextParsingHelper : NSObject
+
+/**
+ Parses a string and returns a dictionary of parameters according to the following rules:
+ * The first line is parsed as title
+ * If the first line contains >> then everything after >> is considered notes.
+ * If a line starts with #, the rest will be interpreted as a comma separated list of tags.
+ * If a line starts with @, the rest will be interpreted as the date.
+ * If a line starts with !, the rest will be interpreted as the deadline.
+ @param text the
+ @return A dictionary with the parameters for the `add` route of the things API
+ */
++ (NSMutableDictionary *)parseText:(NSString*)text;
+@end
+
+NS_ASSUME_NONNULL_END