OCCommunication.h 57 KB

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