OCCommunication.h 50 KB

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