|
| 1 | +// |
| 2 | +// OCAppProvider.h |
| 3 | +// ownCloudSDK |
| 4 | +// |
| 5 | +// Created by Felix Schwarz on 05.09.22. |
| 6 | +// Copyright © 2022 ownCloud GmbH. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +/* |
| 10 | + * Copyright (C) 2022, ownCloud GmbH. |
| 11 | + * |
| 12 | + * This code is covered by the GNU Public License Version 3. |
| 13 | + * |
| 14 | + * For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/ |
| 15 | + * You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>. |
| 16 | + * |
| 17 | + */ |
| 18 | + |
| 19 | +#import <Foundation/Foundation.h> |
| 20 | + |
| 21 | +typedef NSString* OCAppProviderAPIVersion; |
| 22 | +typedef NSString* OCAppProviderKey NS_TYPED_ENUM; |
| 23 | +typedef NSArray<NSDictionary<OCAppProviderKey,id> *> *OCAppProviderAppList; |
| 24 | + |
| 25 | +@class OCAppProviderApp; |
| 26 | +@class OCAppProviderFileType; |
| 27 | + |
| 28 | +NS_ASSUME_NONNULL_BEGIN |
| 29 | + |
| 30 | +@interface OCAppProvider : NSObject |
| 31 | + |
| 32 | +@property(assign) BOOL enabled; |
| 33 | + |
| 34 | +@property(strong,nullable) OCAppProviderAPIVersion version; |
| 35 | +@property(nonatomic,assign) BOOL isSupported; //!< Computed property indicating if the API version is supported by the SDK |
| 36 | + |
| 37 | +@property(strong,nullable) NSString *appsURLPath; //!< relative URL providing a list of available apps and their corresponding types |
| 38 | +@property(strong,nullable) NSString *openURLPath; //!< relative URL to open a file (GET/POST/…) |
| 39 | +@property(strong,nullable) NSString *openWebURLPath; //!< relative URL to open a file using web (GET only) |
| 40 | +@property(strong,nullable) NSString *createURLPath; //!< relative URL to create a new file (newURL, needs to be named createURL due to compiler-enforced Cocoa naming conventions) |
| 41 | + |
| 42 | +@property(strong,nullable,nonatomic) OCAppProviderAppList appList; //!< Raw app list as returned from the server. Setting this property parses the list and generates OCAppProviderApp and OCAppProviderFileType instances |
| 43 | + |
| 44 | +@property(strong,nullable,readonly) NSArray<OCAppProviderApp *> *apps; //!< OCAppProviderApp instances created from the raw .appList |
| 45 | +@property(strong,nullable,readonly) NSArray<OCAppProviderFileType *> *types; //!< OCAppProviderFileType instances created from the raw .appList |
| 46 | + |
| 47 | +@end |
| 48 | + |
| 49 | +// Keys as described at https://owncloud.dev/services/app-registry/apps/#listing-available-apps--mime-types |
| 50 | +extern OCAppProviderKey OCAppProviderKeyMIMEType; //!< corresponds to key "mime_type" (string) |
| 51 | +extern OCAppProviderKey OCAppProviderKeyExtension; //!< corresponds to key "ext" (string) |
| 52 | +extern OCAppProviderKey OCAppProviderKeyName; //!< corresponds to key "name" (string) |
| 53 | +extern OCAppProviderKey OCAppProviderKeyIcon; //!< corresponds to key "icon" (string) |
| 54 | +extern OCAppProviderKey OCAppProviderKeyDescription; //!< corresponds to key "description" (string) |
| 55 | +extern OCAppProviderKey OCAppProviderKeyAllowCreation; //!< corresponds to key "allow_creation" (bool) |
| 56 | +extern OCAppProviderKey OCAppProviderKeyDefaultApplication; //!< corresponds to key "default_application" (string) |
| 57 | +extern OCAppProviderKey OCAppProviderKeyAppProviders; //!< corresponds to key "app_providers" (array of dictionaries) |
| 58 | + |
| 59 | +extern OCAppProviderKey OCAppProviderKeyAppProviderName; //!< corresponds to key app_providers[].name (string) |
| 60 | +extern OCAppProviderKey OCAppProviderKeyAppProviderIcon; //!< corresponds to key app_providers[].icon (URL string) |
| 61 | + |
| 62 | +NS_ASSUME_NONNULL_END |
0 commit comments