From 1613c951d49e6d85aff52f312d57fa087b35c079 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 10 Sep 2025 22:48:37 +0200 Subject: Move things URL calls to a helper --- QSThingsPlugin/Helpers/ThingsHelper.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 QSThingsPlugin/Helpers/ThingsHelper.h (limited to 'QSThingsPlugin/Helpers/ThingsHelper.h') diff --git a/QSThingsPlugin/Helpers/ThingsHelper.h b/QSThingsPlugin/Helpers/ThingsHelper.h new file mode 100644 index 0000000..29d3092 --- /dev/null +++ b/QSThingsPlugin/Helpers/ThingsHelper.h @@ -0,0 +1,34 @@ +#import "KeychainHelper.h" +#import "Constants.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + Enum of valid Things URL routes. + */ +typedef NSString* ThingsURLRoute NS_STRING_ENUM; + +extern ThingsURLRoute const ThingsURLRouteSearch; +extern ThingsURLRoute const ThingsURLRouteShow; +extern ThingsURLRoute const ThingsURLRouteUpdate; +extern ThingsURLRoute const ThingsURLRouteUpdateProject; +extern ThingsURLRoute const ThingsURLRouteAdd; +extern ThingsURLRoute const ThingsURLRouteAddProject; + +/** + Helper class to communicate with things using the URL API + */ +@interface ThingsHelper : NSObject + +/** + Calls a Things URL route with the specified parameters + @param route the Things URL route to call. Use ThingsURLRoute enum. + @param parameters NSDictionary of query parameters to include in the URL. Can be nil or empty. + @returns YES if the URL was successfully opened, NO if something went wrong. + */ ++ (BOOL)callRoute:(ThingsURLRoute)route withParameters:(NSDictionary *)parameters; + +@end + +NS_ASSUME_NONNULL_END -- cgit