OCCommunication.h 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. //
  2. // OCCommunication.h
  3. // Owncloud iOs Client
  4. //
  5. // Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. //
  24. // Add : getNotificationServer & setNotificationServer
  25. // Add : getUserProfileServer
  26. // Add : Support for Favorite
  27. // Add : getActivityServer
  28. //
  29. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  30. // Copyright (c) 2017 Marino Faggiana. All rights reserved.
  31. //
  32. #import <Foundation/Foundation.h>
  33. @class OCHTTPRequestOperation;
  34. @class AFURLSessionManager;
  35. @class AFSecurityPolicy;
  36. @class OCCapabilities;
  37. @class OCUserProfile;
  38. @class HCFeatures;
  39. @interface OCCommunication : NSObject
  40. //Type of credential
  41. typedef enum {
  42. credentialNotSet = -1,
  43. credentialNormal = 0, //user, password
  44. credentialCookie = 1,
  45. credentialOauth = 2
  46. } kindOfCredentialEnum;
  47. typedef enum {
  48. OCErrorUnknow = 90, //On all errors
  49. OCErrorForbidenCharacters = 100, //On create folder and rename
  50. OCErrorMovingDestinyNameHaveForbiddenCharacters = 110,//On move file or folder
  51. OCErrorMovingTheDestinyAndOriginAreTheSame = 111, //On move file or folder
  52. OCErrorMovingFolderInsideHimself = 112, //On move file or folder
  53. OCErrorFileToUploadDoesNotExist = 120 //The file that we want upload does not exist
  54. } OCErrorEnum;
  55. //Private properties
  56. @property NSInteger kindOfCredential;
  57. @property (nonatomic, strong) NSString *user;
  58. @property (nonatomic, strong) NSString *userID;
  59. @property (nonatomic, strong) NSString *password;
  60. @property (nonatomic, strong) NSString *userAgent;
  61. //Public properties
  62. @property (nonatomic, strong) NSMutableArray *downloadTaskNetworkQueueArray;
  63. @property (nonatomic, strong) AFURLSessionManager *uploadSessionManager;
  64. @property (nonatomic, strong) AFURLSessionManager *downloadSessionManager;
  65. @property (nonatomic, strong) AFURLSessionManager *networkSessionManager;
  66. @property (nonatomic, strong) AFSecurityPolicy * securityPolicy;
  67. /*This flag control the use of cookies on the requests.
  68. -On OC6 the use of cookies limit to one request at the same time. So if we want to do several requests at the same time you should set this as NO (by default).
  69. -On OC7 we can do several requests at the same time with the same session so you can set this flag to YES.
  70. */
  71. @property BOOL isCookiesAvailable;
  72. /* This flag indicate if the server handling forbidden characters */
  73. @property BOOL isForbiddenCharactersAvailable;
  74. ///-----------------------------------
  75. /// @name Init with Upload Session Manager
  76. ///-----------------------------------
  77. /**
  78. * Method to init the OCCommunication with a AFURLSessionManager (upload session) to receive the SSL callbacks to support Self Signed servers
  79. *
  80. * @param uploadSessionManager -> AFURLSessionManager
  81. */
  82. -(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager;
  83. /**
  84. * Method to init the OCCommunication with a AFURLSessionManager (uploads and downloads sessions) to receive the SSL callbacks to support Self Signed servers
  85. *
  86. * @param uploadSessionManager -> AFURLSessionManager
  87. * @param downloadSessionManager -> AFURLSessionManager
  88. *
  89. */
  90. -(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager andDownloadSessionManager:(AFURLSessionManager *) downloadSessionManager andNetworkSessionManager:(AFURLSessionManager *) networkSessionManager;
  91. - (AFSecurityPolicy *) createSecurityPolicy;
  92. - (void)setSecurityPolicyManagers:(AFSecurityPolicy *)securityPolicy;
  93. #pragma mark - Credentials
  94. ///-----------------------------------
  95. /// @name Set Credential With User
  96. ///-----------------------------------
  97. /**
  98. * Method to set credentials with user and password
  99. *
  100. * @param user -> NSString username
  101. * @param userID -> NSString userID
  102. * @param password -> NSString password
  103. */
  104. - (void) setCredentialsWithUser:(NSString*) user andUserID:(NSString *) userID andPassword:(NSString*) password;
  105. ///-----------------------------------
  106. /// @name Set Credential with cookie
  107. ///-----------------------------------
  108. /**
  109. * Method that set credentials with cookie.
  110. * Used for SAML servers.
  111. *
  112. * @param cookie -> NSString cookie string
  113. */
  114. - (void) setCredentialsWithCookie:(NSString*) cookie;
  115. ///-----------------------------------
  116. /// @name Set Credential with OAuth
  117. ///-----------------------------------
  118. /**
  119. * Method to set credentials for OAuth with token
  120. *
  121. * @param token -> NSString token
  122. */
  123. - (void) setCredentialsOauthWithToken:(NSString*) token;
  124. /**
  125. * @optional
  126. *
  127. * Method to set the user agent, in order to identify the client app to the server.
  128. *
  129. * @param userAgent -> String with the user agent. Ex. "iOS-ownCloud"
  130. */
  131. - (void) setUserAgent:(NSString *)userAgent;
  132. /*
  133. * Method to update the a request with the current credentials
  134. */
  135. - (id) getRequestWithCredentials:(id) request;
  136. #pragma mark - Network operations
  137. ///-----------------------------------
  138. /// @name Check Server
  139. ///-----------------------------------
  140. /**
  141. * Method to check if on the path exist a ownCloud server
  142. *
  143. * @param path -> NSString with the url of the server with
  144. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/
  145. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  146. *
  147. * @warning this method do not need set the Credentials before because with this method we can know the kind of authentication needed.
  148. *
  149. * @warning the "path" must not be on URL Encoding.
  150. * Ex:
  151. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/
  152. *
  153. */
  154. - (void) checkServer: (NSString *) path
  155. onCommunication:(OCCommunication *)sharedOCCommunication
  156. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  157. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  158. ///-----------------------------------
  159. /// @name createFolder
  160. ///-----------------------------------
  161. /**
  162. * Method to create a folder giving the full address where we want put the folder
  163. *
  164. * @param path -> NSString with the url where we want put the folder.
  165. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  166. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  167. *
  168. * @param isFCSupported -> From Owncloud 8.1 the forbidden characters are controller by the server except the '/'. With this flag
  169. * we controller if the server support forbbiden characters. To know that you can use "hasServerForbiddenCharactersSupport ..." request in this class.
  170. *
  171. * @warning remember that you must to set the Credentials before call this method or any other.
  172. *
  173. * @warning the "path" must not be on URL Encoding.
  174. * Ex:
  175. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop Music/
  176. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop%20Music/
  177. *
  178. * @warning the folder name must not contain the next forbidden characers: "\", "/","<",">",":",""","|","?","*"
  179. */
  180. - (void) createFolder: (NSString *) path
  181. onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
  182. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  183. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
  184. errorBeforeRequest:(void(^)(NSError *error)) errorBeforeRequest;
  185. ///-----------------------------------
  186. /// @name moveFileOrFolder
  187. ///-----------------------------------
  188. /**
  189. * Method to move or rename a file/folder
  190. *
  191. * MOVE
  192. * @param sourcePath -> NSString with the url of the file or folder that you want move
  193. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  194. * @param destinyPath -> NSString with the new url where we cant move the file or folder
  195. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
  196. *
  197. * RENAME
  198. * @param sourcePath -> NSString with the url of the file or folder that you want move
  199. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  200. * @param destinyPath -> NSString with the new url where we cant move the file or folder
  201. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Movies
  202. *
  203. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  204. *
  205. * @param isFCSupported -> From Owncloud 8.1 the forbidden characters are controller by the server except the '/'. With this flag
  206. * we controller if the server support forbbiden characters. To know that you can use "hasServerForbiddenCharactersSupport ..." request in this class.
  207. *
  208. * @warning the move will overwritte an existing file on the destiny.
  209. *
  210. * @warning remember that you must to set the Credentials before call this method or any other.
  211. *
  212. * @warning the "sourcePath" and "destinyPath" must not be on URL Encoding.
  213. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
  214. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
  215. *
  216. * @warning: to move a folder the "sourcePath" and "destinyPath" must end on "/" character
  217. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music/
  218. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  219. *
  220. * @warning: to move a file the "sourcePath" and "destinyPath" must not end on "/" character
  221. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music.mp3
  222. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music.mp3/
  223. */
  224. - (void) moveFileOrFolder:(NSString *)sourcePath
  225. toDestiny:(NSString *)destinyPath
  226. onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
  227. successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectServer))successRequest
  228. failureRequest:(void (^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest
  229. errorBeforeRequest:(void (^)(NSError *error))errorBeforeRequest;
  230. ///-----------------------------------
  231. /// @name Read Folder
  232. ///-----------------------------------
  233. /**
  234. * Block to get the list of files/folders for a path
  235. *
  236. * @param path -> NSString with the url of the path
  237. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  238. *
  239. * @param token -> User Session token. To get this token you should be use "getUserSessionToken" method of UtilsFramework class
  240. * We use this token to be sure that the callbacks of the request are for the correct user. We need that when we use multiaccount.
  241. * if not you can leave as nil.
  242. *
  243. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  244. *
  245. * @warning the "path" must not be on URL Encoding.
  246. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
  247. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
  248. *
  249. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  250. *
  251. */
  252. - (void) readFolder: (NSString *) path depth:(NSString *)depth withUserSessionToken:(NSString *)token
  253. onCommunication:(OCCommunication *)sharedOCCommunication
  254. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest
  255. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
  256. ///-----------------------------------
  257. /// @name Read File
  258. ///-----------------------------------
  259. /**
  260. * Block to get the unique file/folder of a path. Used to get the properties of the file.
  261. *
  262. * @param path -> NSString with the url of the path
  263. * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
  264. *
  265. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  266. *
  267. * @warning the "path" must not be on URL Encoding.
  268. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
  269. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
  270. *
  271. */
  272. - (void) readFile: (NSString *) path
  273. onCommunication:(OCCommunication *)sharedOCCommunication
  274. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest
  275. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  276. ///-----------------------------------
  277. /// @name Delete a file or a folder
  278. ///-----------------------------------
  279. /**
  280. * This method delete a file or a folder
  281. *
  282. * @param path -> NSString with the url of the file or the folder that the user want to delete
  283. * Ex:http://www.myowncloudserver.com/owncloud/remote.php/webdav/Folder
  284. *
  285. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  286. *
  287. * @warning the "path" must not be on URL Encoding.
  288. * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
  289. * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
  290. *
  291. * @warning remember that you must to set the Credentials before call this method or any other.
  292. *
  293. */
  294. - (void) deleteFileOrFolder:(NSString *)path
  295. onCommunication:(OCCommunication *)sharedOCCommunication
  296. successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
  297. failureRquest:(void (^)(NSHTTPURLResponse *resposne, NSError *error, NSString *redirectedServer))failureRequest;
  298. ///-----------------------------------
  299. /// @name Download File Session
  300. ///-----------------------------------
  301. /**
  302. * Method to download a file. All the files will be download one by one in a queue. The files download also in background when the system close the app.
  303. *
  304. * This method download a file of a path and returns blocks
  305. *
  306. * progress: get the download inputs about the progress of the download
  307. * successRequest: the download it's complete
  308. * failureRequest: the download fail
  309. *
  310. * @param NSString -> remotePath the path of the file
  311. * @param NSString -> localPath the local path where we want store the file
  312. * @param BOOL -> defaultPriority define if the priority is defined by the library (default) or not. It used to manage multiple downloads from the app.
  313. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  314. *
  315. * @return NSURLSessionDownloadTask -> You can cancel the download using this object
  316. * Ex: [downloadTask cancel]
  317. *
  318. * @warning remember that you must to set the Credentials before call this method or any other.
  319. *
  320. * @warning this method use NSURLSession only supported in iOS 7, with iOS 6 use the previous method
  321. *
  322. */
  323. - (NSURLSessionDownloadTask *) downloadFileSession:(NSString *)remotePath toDestiny:(NSString *)localPath defaultPriority:(BOOL)defaultPriority onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))downloadProgress successRequest:(void(^)(NSURLResponse *response, NSURL *filePath)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSError *error)) failureRequest;
  324. ///-----------------------------------
  325. /// @name Set Download Task Complete Block
  326. ///-----------------------------------
  327. /**
  328. *
  329. * Method to set the callbak block of the pending download background tasks.
  330. *
  331. * @param block A block object to be executed when a session task is completed. The block should be return the location where the download must be stored, and takes three arguments: the session, the download task, and location where is stored the file.
  332. *
  333. */
  334. - (void)setDownloadTaskComleteBlock: (NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
  335. ///-----------------------------------
  336. /// @name Set Download Task Did Get Body Data Block
  337. ///-----------------------------------
  338. /**
  339. * Sets a block that get callbacks of the NSURLDownloadSessionTask progress
  340. *
  341. * @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes four arguments: the session, the download task, the number of the bytes read, the total bytes expected to read. This block may be called multiple times, and will execute on the main thread.
  342. */
  343. - (void) setDownloadTaskDidGetBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite)) block;
  344. ///-----------------------------------
  345. /// @name Upload File
  346. ///-----------------------------------
  347. /**
  348. * Method to upload a file. All the files will be upload one by one in a queue. The files upload also in background when the system close the app.
  349. *
  350. * This method download a file of a path and returns blocks
  351. *
  352. * progress: get the download inputs about the progress of the download
  353. * successRequest: the download it's complete
  354. * failureRequest: the download fail
  355. * failureBeforeRequest: the download fail
  356. *
  357. * @param NSString -> localPath the path where is the file that we want upload
  358. * @param NSString -> remotePath the path where we want upload the file
  359. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  360. *
  361. * @return NSURLSessionUploadTask -> You can cancel the upload using this object
  362. * Ex: [uploadTask cancel]
  363. *
  364. * @warning remember that you must to set the Credentials before call this method or any other.
  365. *
  366. * @warning this method use NSURLSession only supported in iOS 7, with iOS 6 use the previous method
  367. *
  368. */
  369. - (NSURLSessionUploadTask *) uploadFileSession:(NSString *) localPath toDestiny:(NSString *) remotePath onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))uploadProgress successRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer, NSError *error)) failureRequest failureBeforeRequest:(void(^)(NSError *error)) failureBeforeRequest;
  370. ///-----------------------------------
  371. /// @name Set Task Did Complete Block
  372. ///-----------------------------------
  373. /**
  374. *
  375. * Method to set the callbaks block of the pending background tasks.
  376. *
  377. * @param block A block object to be executed when a session task is completed. The blockhas not return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task.
  378. *
  379. */
  380. - (void) setTaskDidCompleteBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, NSError *error)) block;
  381. ///-----------------------------------
  382. /// @name Set Task Did Send Body Data Block
  383. ///-----------------------------------
  384. /**
  385. * Sets a block that get callbacks of the NSURLSessionTask progress
  386. *
  387. * @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.
  388. */
  389. - (void) setTaskDidSendBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend)) block;
  390. ///-----------------------------------
  391. /// @name Search
  392. ///-----------------------------------
  393. - (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
  394. ///-----------------------------------
  395. /// @name Setting favorite
  396. ///-----------------------------------
  397. - (void)settingFavoriteServer:(NSString *)path andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
  398. ///-----------------------------------
  399. /// @name Listing favorites
  400. ///-----------------------------------
  401. - (void)listingFavorites:(NSString *)path folder:(NSString *)folder withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
  402. #pragma mark - OC API Calls
  403. ///-----------------------------------
  404. /// @name getCurrentServerVersion
  405. ///-----------------------------------
  406. /**
  407. * Method to get the current version without request if this feature has been checked by other request as: getServerVersionWithPath,
  408. * hasServerShareSupport, hasServerCookiesSupport and hasServerForbiddenCharactersSupport methods
  409. *
  410. * @return serverVersion as NSString.
  411. */
  412. - (NSString *) getCurrentServerVersion;
  413. ///-----------------------------------
  414. /// @name getServerVersionWithPath
  415. ///-----------------------------------
  416. /**
  417. * Method to get the current version of a server. This method update the currentServerVersion property of the class
  418. *
  419. *
  420. * @param path -> NSString server path
  421. *
  422. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  423. *
  424. * @return serverVersion as NSString.
  425. */
  426. - (void) getServerVersionWithPath:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
  427. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *serverVersion, NSString *redirectedServer)) success
  428. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
  429. ///-----------------------------------
  430. /// @name requestForUserNameByCookie
  431. ///-----------------------------------
  432. /**
  433. * Method to get the User name by the cookie of the session. Used with SAML servers.
  434. *
  435. * @param cookieString -> NSString The cookie of the session
  436. *
  437. * @param path -> NSString server path
  438. *
  439. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  440. */
  441. - (void) getUserNameByCookie:(NSString *) cookieString ofServerPath:(NSString *)path onCommunication:
  442. (OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *response, NSData *responseData, NSString *redirectedServer))success
  443. failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failure;
  444. ///-----------------------------------
  445. /// @name Get Features Supported By Server
  446. ///-----------------------------------
  447. /**
  448. * Method get the features supported by the path server using the version string.
  449. *
  450. * Right now support:
  451. * - Share API
  452. * - Sharee API
  453. * - Cookies
  454. * - Forbidden character manage by the server side
  455. * - Capabilities
  456. *
  457. * @param path -> NSString server path
  458. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  459. *
  460. * @return BOOL in the success about the support of Share (hasShareSupport) ,Sharee (hasShareeSupport) APIs,
  461. * Cookies (hasCookiesSupport), Forbidden character (hasForbiddenCharactersSupport) and Capabilities (hasCapabilitiesSupport)
  462. *
  463. */
  464. - (void) getFeaturesSupportedByServer:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
  465. successRequest:(void(^)(NSHTTPURLResponse *response, BOOL hasShareSupport, BOOL hasShareeSupport, BOOL hasCookiesSupport, BOOL hasForbiddenCharactersSupport, BOOL hasCapabilitiesSupport, BOOL hasFedSharesOptionShareSupport, NSString *redirectedServer)) success
  466. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
  467. ///-----------------------------------
  468. /// @name readSharedByServer
  469. ///-----------------------------------
  470. /**
  471. * Method to return all the files and folders shareds on the server by the current user
  472. *
  473. * @param path -> NSString server path
  474. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  475. *
  476. * @return NSArray with all the OCSharedDto of shareds files
  477. *
  478. */
  479. - (void) readSharedByServer: (NSString *) path
  480. onCommunication:(OCCommunication *)sharedOCCommunication
  481. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
  482. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  483. ///-----------------------------------
  484. /// @name readSharedByServer
  485. ///-----------------------------------
  486. /**
  487. * Method to return the files and folders shareds on a concrete path by the current user
  488. *
  489. * @param serverPath -> NSString server path
  490. * @param path -> Path of the folder that we want to know that shareds that contain
  491. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  492. *
  493. * @return NSArray with all the OCSharedDto of shareds files
  494. *
  495. */
  496. - (void) readSharedByServer: (NSString *) serverPath andPath: (NSString *) path
  497. onCommunication:(OCCommunication *)sharedOCCommunication
  498. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
  499. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  500. ///-----------------------------------
  501. /// @name shareFileOrFolderByServer
  502. ///-----------------------------------
  503. /**
  504. * Method to share a file or folder with password
  505. *
  506. * @param serverPath -> NSString server path
  507. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  508. * @param password -> password
  509. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  510. *
  511. * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
  512. *
  513. * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
  514. */
  515. - (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath andPassword:(NSString *)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
  516. onCommunication:(OCCommunication *)sharedOCCommunication
  517. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest
  518. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  519. ///-----------------------------------
  520. /// @name shareFileOrFolderByServer
  521. ///-----------------------------------
  522. /**
  523. * Method to share a file or folder
  524. *
  525. * @param serverPath -> NSString server path
  526. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  527. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  528. *
  529. * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
  530. *
  531. * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
  532. */
  533. - (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath
  534. onCommunication:(OCCommunication *)sharedOCCommunication
  535. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *shareLink, NSString *redirectedServer)) successRequest
  536. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest ;
  537. ///-----------------------------------
  538. /// @name shareWith
  539. ///-----------------------------------
  540. /**
  541. * Method to share a file or folder with user or group
  542. *
  543. * @param userOrGroup -> NSString user or group name
  544. * @param shareeType -> NSInteger: to set the type of sharee (user/group/federated)
  545. * @param serverPath -> NSString server path
  546. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  547. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  548. *
  549. * @return request response, error if exists and redirected server if exist.
  550. *
  551. * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
  552. */
  553. - (void)shareWith:(NSString *)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString *) serverPath andFileOrFolderPath:(NSString *)filePath andPermissions:(NSInteger)permissions onCommunication:(OCCommunication *)sharedOCCommunication
  554. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
  555. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest;
  556. ///-----------------------------------
  557. /// @name unShareFileOrFolderByServer
  558. ///-----------------------------------
  559. /**
  560. * Method to share a file or folder
  561. *
  562. * @param path -> NSString server path
  563. * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
  564. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  565. *
  566. */
  567. - (void) unShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
  568. onCommunication:(OCCommunication *)sharedOCCommunication
  569. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  570. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  571. ///-----------------------------------
  572. /// @name isShareFileOrFolderByServer
  573. ///-----------------------------------
  574. /**
  575. * Method to know if a share item still shared
  576. *
  577. * @param path -> NSString server path
  578. * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
  579. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  580. *
  581. */
  582. - (void) isShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
  583. onCommunication:(OCCommunication *)sharedOCCommunication
  584. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, BOOL isShared, id shareDto)) successRequest
  585. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  586. ///-----------------------------------
  587. /// @name UpdteShared
  588. ///-----------------------------------
  589. /**
  590. * Method to update a shared file with password and expiration time
  591. *
  592. * @param shareID -> NSInteger share id, you can get this data of these calls (readSharedByServer...)
  593. * @param serverPath -> NSString server path
  594. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  595. * @param password -> password
  596. * @param permissions -> NSInteger 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
  597. * @param expirationTime -> expirationTime in format "YYYY-MM-dd"
  598. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  599. *
  600. * @return token of the file that we shared. Ex:572d48de3814c90117fbca6442f2f3b2
  601. *
  602. * @warning it only can be updated one parameter for each request so if you want to update the password the date must be nil and the permission 0
  603. * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
  604. */
  605. - (void) updateShare:(NSInteger)shareId ofServerPath:(NSString *)serverPath withPasswordProtect:(NSString*)password andExpirationTime:(NSString*)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
  606. onCommunication:(OCCommunication *)sharedOCCommunication
  607. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  608. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  609. ///-----------------------------------
  610. /// @name Search Users And Groups
  611. ///-----------------------------------
  612. /**
  613. * Method to get users and groups using a search string
  614. *
  615. * @param searchString -> NSString search string
  616. * @param page -> NInsteger: Number of page (pagination support)
  617. * @param resultsPerPage -> NSInteger: Number of results per page (pagination support)
  618. * @param serverPath -> NSString server path
  619. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  620. *
  621. * @return itemList -> list of OCShareUser objects and default -> request response, error if exists and redirected server if exist
  622. *
  623. * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
  624. */
  625. - (void) searchUsersAndGroupsWith:(NSString *)searchString forPage:(NSInteger)page with:(NSInteger)resultsPerPage ofServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *itemList, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  626. - (void) getSharePermissionsFile:(NSString*)fileName onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *permissions, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  627. ///-----------------------------------
  628. /// @name Get the server capabilities
  629. ///-----------------------------------
  630. /**
  631. * Method read the capabilities of the server
  632. *
  633. * @param serverPath -> NSString server
  634. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  635. *
  636. * @return capabilities -> OCCapabilities
  637. *
  638. */
  639. - (void) getCapabilitiesOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  640. #pragma mark - Remote thumbnails
  641. ///-----------------------------------
  642. /// @name Get the thumbnail for a file
  643. ///-----------------------------------
  644. /**
  645. * Method to get the remote thumbnail for a file
  646. *
  647. * In order to support thumbnails for videos it is necessary to install video package on the server
  648. * and add the following lines in the config.php files
  649. *the following types on the config.php file
  650. * 'enabledPreviewProviders' => array(
  651. * 'OC\Preview\Movie'
  652. * )
  653. *
  654. * @param serverPath -> NSString server, without encoding
  655. * @param filePath -> NSString file path, without encoding
  656. * @param fileWidth -> NSInteger with the width size
  657. * @param fileHeight -> NSInteger with the height size
  658. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  659. *
  660. * @return nsData -> thumbnail of the file with the size requested
  661. * @return NSURLSessionTask -> You can cancel the download using this object
  662. *
  663. */
  664. - (NSURLSessionTask *) getRemotePreviewByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight andA:(NSInteger)a andMode:(NSString *)mode path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication
  665. successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest
  666. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  667. - (NSURLSessionTask *) getRemotePreviewTrashByServer:(NSString*)serverPath ofFileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication
  668. successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest
  669. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  670. - (NSURLSessionTask *) getRemoteThumbnailByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight onCommunication:(OCCommunication *)sharedOCComunication
  671. successRequest:(void(^)(NSHTTPURLResponse *response, NSData *thumbnail, NSString *redirectedServer)) successRequest
  672. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  673. #pragma mark - Server Notification
  674. ///-----------------------------------
  675. /// @name Get the server Notification
  676. ///-----------------------------------
  677. /**
  678. * Method read the notification of the server
  679. *
  680. * @param serverPath -> NSString server
  681. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  682. *
  683. * @return listOfNotifications -> OCNotification
  684. *
  685. */
  686. - (void) getNotificationServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  687. ///-----------------------------------
  688. /// @name Set the server Notification
  689. ///-----------------------------------
  690. /**
  691. * Method read the notification of the server
  692. *
  693. * @param serverPath -> NSString server
  694. * @param type -> NSString "POST" "DELETE"
  695. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  696. *
  697. */
  698. - (void) setNotificationServer:(NSString*)serverPath type:(NSString *)type onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  699. ///-----------------------------------
  700. /// @name Subscribing at the Nextcloud server
  701. ///-----------------------------------
  702. /**
  703. * Method subscribing at the Nextcloud server for the push
  704. *
  705. * @param serverPath -> NSString server
  706. * @param pushTokenHash -> NSString sha512 hash of the PushToken for Apple Push Notification Service
  707. * @param devicePublicKey -> NSString devicePublicKey
  708. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  709. *
  710. */
  711. - (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey proxyServerPath:(NSString *)proxyServerPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
  712. - (void)unsubscribingNextcloudServerPush:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
  713. - (void)subscribingPushProxy:(NSString *)serverPath pushToken:(NSString *)pushToken deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
  714. - (void)unsubscribingPushProxy:(NSString *)serverPath deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
  715. #pragma mark - Server Activity
  716. ///-----------------------------------
  717. /// @name Get the server Activity
  718. ///-----------------------------------
  719. /**
  720. * Method read the notification of the server
  721. *
  722. * @param serverPath -> NSString server
  723. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  724. *
  725. * @return listOfActivity -> OCActivity
  726. *
  727. */
  728. - (void) getActivityServer:(NSString*)serverPath since:(NSInteger)since limit:(NSInteger)limit previews:(BOOL)previews link:(NSString *)link onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  729. #pragma mark - External Sites
  730. ///-----------------------------------
  731. /// @name Get the list of External sites
  732. ///-----------------------------------
  733. /**
  734. * Method read the notification of the server
  735. *
  736. * @param serverPath -> NSString server
  737. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  738. *
  739. * @return listOfExternalSites -> OCExternalSites
  740. *
  741. */
  742. - (void) getExternalSitesServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  743. #pragma mark - User Profile
  744. ///-----------------------------------
  745. /// @name Get User Profile
  746. ///-----------------------------------
  747. /**
  748. * Method read the notification of the server
  749. *
  750. * @param serverPath -> NSString server
  751. * @param type -> NSString "GET"
  752. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  753. *
  754. */
  755. - (void) getUserProfileServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  756. #pragma mark - End-to-End Encryption
  757. - (void)getEndToEndPublicKeys:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  758. - (void)getEndToEndPrivateKeyCipher:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKeyChiper, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  759. - (void)getEndToEndServerPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  760. - (void)signEndToEndPublicKey:(NSString*)serverPath publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey,NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  761. - (void)storeEndToEndPrivateKeyCipher:(NSString*)serverPath privateKeyChiper:(NSString *)privateKeyChiper onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  762. - (void)deleteEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  763. - (void)deleteEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  764. - (void)markEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  765. - (void)deletemarkEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  766. - (void)lockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  767. - (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  768. - (void)getEndToEndMetadata:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  769. - (void)storeEndToEndMetadata:(NSString*)serverPath fileID:(NSString *)fileID encryptedMetadata:(NSString *)encryptedMetadata onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  770. - (void)updateEndToEndMetadata:(NSString*)serverPath fileID:(NSString *)fileID encryptedMetadata:(NSString *)encryptedMetadata token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  771. - (void)deleteEndToEndMetadata:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  772. #pragma mark - Manage Mobile Editor OCS API
  773. - (void)createLinkRichdocuments:(NSString *)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  774. - (void)geTemplatesRichdocuments:(NSString *)serverPath typeTemplate:(NSString *)typeTemplate onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfTemplate, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  775. - (void)createNewRichdocuments:(NSString *)serverPath path:(NSString *)path templateID:(NSString *)templateID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  776. - (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  777. #pragma mark - Trash
  778. - (void)listingTrash:(NSString *)path depth:(NSString *)depth onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  779. - (void)emptyTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  780. #pragma mark - Third Parts
  781. - (void)getHCUserProfile:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  782. - (void)setHCUserProfile:(NSString*)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  783. - (void)getHCFeatures:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, HCFeatures *features, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  784. @end