OCCommunication.h 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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 encode:(BOOL)encode 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. - (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem 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;
  395. ///-----------------------------------
  396. /// @name Setting favorite
  397. ///-----------------------------------
  398. - (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;
  399. ///-----------------------------------
  400. /// @name Listing favorites
  401. ///-----------------------------------
  402. - (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;
  403. #pragma mark - OC API Calls
  404. ///-----------------------------------
  405. /// @name getCurrentServerVersion
  406. ///-----------------------------------
  407. /**
  408. * Method to get the current version without request if this feature has been checked by other request as: getServerVersionWithPath,
  409. * hasServerShareSupport, hasServerCookiesSupport and hasServerForbiddenCharactersSupport methods
  410. *
  411. * @return serverVersion as NSString.
  412. */
  413. - (NSString *) getCurrentServerVersion;
  414. ///-----------------------------------
  415. /// @name getServerVersionWithPath
  416. ///-----------------------------------
  417. /**
  418. * Method to get the current version of a server. This method update the currentServerVersion property of the class
  419. *
  420. *
  421. * @param path -> NSString server path
  422. *
  423. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  424. *
  425. * @return serverVersion as NSString.
  426. */
  427. - (void) getServerVersionWithPath:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
  428. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *serverVersion, NSString *redirectedServer)) success
  429. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
  430. ///-----------------------------------
  431. /// @name requestForUserNameByCookie
  432. ///-----------------------------------
  433. /**
  434. * Method to get the User name by the cookie of the session. Used with SAML servers.
  435. *
  436. * @param cookieString -> NSString The cookie of the session
  437. *
  438. * @param path -> NSString server path
  439. *
  440. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  441. */
  442. - (void) getUserNameByCookie:(NSString *) cookieString ofServerPath:(NSString *)path onCommunication:
  443. (OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *response, NSData *responseData, NSString *redirectedServer))success
  444. failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failure;
  445. ///-----------------------------------
  446. /// @name Get Features Supported By Server
  447. ///-----------------------------------
  448. /**
  449. * Method get the features supported by the path server using the version string.
  450. *
  451. * Right now support:
  452. * - Share API
  453. * - Sharee API
  454. * - Cookies
  455. * - Forbidden character manage by the server side
  456. * - Capabilities
  457. *
  458. * @param path -> NSString server path
  459. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  460. *
  461. * @return BOOL in the success about the support of Share (hasShareSupport) ,Sharee (hasShareeSupport) APIs,
  462. * Cookies (hasCookiesSupport), Forbidden character (hasForbiddenCharactersSupport) and Capabilities (hasCapabilitiesSupport)
  463. *
  464. */
  465. - (void) getFeaturesSupportedByServer:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
  466. successRequest:(void(^)(NSHTTPURLResponse *response, BOOL hasShareSupport, BOOL hasShareeSupport, BOOL hasCookiesSupport, BOOL hasForbiddenCharactersSupport, BOOL hasCapabilitiesSupport, BOOL hasFedSharesOptionShareSupport, NSString *redirectedServer)) success
  467. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
  468. ///-----------------------------------
  469. /// @name readSharedByServer
  470. ///-----------------------------------
  471. /**
  472. * Method to return all the files and folders shareds on the server by the current user
  473. *
  474. * @param path -> NSString server path
  475. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  476. *
  477. * @return NSArray with all the OCSharedDto of shareds files
  478. *
  479. */
  480. - (void) readSharedByServer: (NSString *) path
  481. onCommunication:(OCCommunication *)sharedOCCommunication
  482. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
  483. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  484. ///-----------------------------------
  485. /// @name readSharedByServer
  486. ///-----------------------------------
  487. /**
  488. * Method to return the files and folders shareds on a concrete path by the current user
  489. *
  490. * @param serverPath -> NSString server path
  491. * @param path -> Path of the folder that we want to know that shareds that contain
  492. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  493. *
  494. * @return NSArray with all the OCSharedDto of shareds files
  495. *
  496. */
  497. - (void) readSharedByServer: (NSString *) serverPath andPath: (NSString *) path
  498. onCommunication:(OCCommunication *)sharedOCCommunication
  499. successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
  500. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  501. ///-----------------------------------
  502. /// @name shareFileOrFolderByServer
  503. ///-----------------------------------
  504. /**
  505. * Method to share a file or folder with password
  506. *
  507. * @param serverPath -> NSString server path
  508. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  509. * @param password -> password
  510. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  511. *
  512. * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
  513. *
  514. * @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
  515. */
  516. - (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath andPassword:(NSString *)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
  517. onCommunication:(OCCommunication *)sharedOCCommunication
  518. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest
  519. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  520. ///-----------------------------------
  521. /// @name shareFileOrFolderByServer
  522. ///-----------------------------------
  523. /**
  524. * Method to share a file or folder
  525. *
  526. * @param serverPath -> NSString server path
  527. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  528. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  529. *
  530. * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
  531. *
  532. * @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
  533. */
  534. - (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath
  535. onCommunication:(OCCommunication *)sharedOCCommunication
  536. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *shareLink, NSString *redirectedServer)) successRequest
  537. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest ;
  538. ///-----------------------------------
  539. /// @name shareWith
  540. ///-----------------------------------
  541. /**
  542. * Method to share a file or folder with user or group
  543. *
  544. * @param userOrGroup -> NSString user or group name
  545. * @param shareeType -> NSInteger: to set the type of sharee (user/group/federated)
  546. * @param serverPath -> NSString server path
  547. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  548. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  549. *
  550. * @return request response, error if exists and redirected server if exist.
  551. *
  552. * @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
  553. */
  554. - (void)shareWith:(NSString *)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString *) serverPath andFileOrFolderPath:(NSString *)filePath andPermissions:(NSInteger)permissions onCommunication:(OCCommunication *)sharedOCCommunication
  555. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
  556. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest;
  557. ///-----------------------------------
  558. /// @name unShareFileOrFolderByServer
  559. ///-----------------------------------
  560. /**
  561. * Method to share a file or folder
  562. *
  563. * @param path -> NSString server path
  564. * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
  565. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  566. *
  567. */
  568. - (void) unShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
  569. onCommunication:(OCCommunication *)sharedOCCommunication
  570. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  571. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  572. ///-----------------------------------
  573. /// @name isShareFileOrFolderByServer
  574. ///-----------------------------------
  575. /**
  576. * Method to know if a share item still shared
  577. *
  578. * @param path -> NSString server path
  579. * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
  580. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  581. *
  582. */
  583. - (void) isShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
  584. onCommunication:(OCCommunication *)sharedOCCommunication
  585. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, BOOL isShared, id shareDto)) successRequest
  586. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  587. ///-----------------------------------
  588. /// @name UpdteShared
  589. ///-----------------------------------
  590. /**
  591. * Method to update a shared file with password and expiration time
  592. *
  593. * @param shareID -> NSInteger share id, you can get this data of these calls (readSharedByServer...)
  594. * @param serverPath -> NSString server path
  595. * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
  596. * @param password -> password
  597. * @param permissions -> NSInteger 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
  598. * @param expirationTime -> expirationTime in format "YYYY-MM-dd"
  599. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  600. *
  601. * @return token of the file that we shared. Ex:572d48de3814c90117fbca6442f2f3b2
  602. *
  603. * @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
  604. * @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
  605. */
  606. - (void) updateShare:(NSInteger)shareId ofServerPath:(NSString *)serverPath withPasswordProtect:(NSString*)password andNote:(NSString *)note andExpirationTime:(NSString*)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
  607. onCommunication:(OCCommunication *)sharedOCCommunication
  608. successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
  609. failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  610. ///-----------------------------------
  611. /// @name Search Users And Groups
  612. ///-----------------------------------
  613. /**
  614. * Method to get users and groups using a search string
  615. *
  616. * @param searchString -> NSString search string
  617. * @param page -> NInsteger: Number of page (pagination support)
  618. * @param resultsPerPage -> NSInteger: Number of results per page (pagination support)
  619. * @param serverPath -> NSString server path
  620. * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
  621. *
  622. * @return itemList -> list of OCShareUser objects and default -> request response, error if exists and redirected server if exist
  623. *
  624. * @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
  625. */
  626. - (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;
  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 size:(NSString *)size 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 objectId:(NSString *)objectId objectType:(NSString *)objectType 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 ocId:(NSString *)ocId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  765. - (void)deletemarkEndToEndFolderEncrypted:(NSString*)serverPath ocId:(NSString *)ocId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  766. - (void)lockEndToEndFolderEncrypted:(NSString*)serverPath ocId:(NSString *)ocId 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 ocId:(NSString *)ocId 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 ocId:(NSString *)ocId 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 ocId:(NSString *)ocId 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 ocId:(NSString *)ocId 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 ocId:(NSString *)ocId 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)getTemplatesRichdocuments:(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 - Fulltextsearch
  778. - (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  779. #pragma mark - Remore wipe
  780. - (void)getRemoteWipeStatus:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, BOOL wipe, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  781. - (void)setRemoteWipeCompletition:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  782. #pragma mark - Trash
  783. - (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;
  784. - (void)emptyTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  785. #pragma mark - Comments
  786. - (void)getComments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *list, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  787. - (void)putComments:(NSString*)serverPath fileId:(NSString *)fileId message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  788. - (void)updateComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  789. - (void)readMarkComments:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  790. - (void)deleteComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest ;
  791. #pragma mark - Third Parts
  792. - (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;
  793. - (void)putHCUserProfile:(NSString*)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
  794. - (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;
  795. @end