|
@@ -245,23 +245,6 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
[operation resume];
|
|
|
}
|
|
|
|
|
|
-- (void)listTrashbinPath:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response, NSString *token))success failure:(void(^)(NSHTTPURLResponse *response, id _Nullable responseObject, NSError *, NSString *token))failure
|
|
|
-{
|
|
|
- NSParameterAssert(success);
|
|
|
-
|
|
|
- _requestMethod = @"PROPFIND";
|
|
|
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
|
|
|
-
|
|
|
- //[request setValue: depth forHTTPHeaderField: @"Depth"];
|
|
|
- [request setHTTPBody:[@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><D:propfind xmlns:D=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><D:prop><D:resourcetype/><D:getlastmodified/><size xmlns=\"http://owncloud.org/ns\"/><favorite xmlns=\"http://owncloud.org/ns\"/><id xmlns=\"http://owncloud.org/ns\"/><D:getcontentlength/><D:getetag/><permissions xmlns=\"http://owncloud.org/ns\"/><D:getcontenttype/><nc:is-encrypted/></D:prop></D:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
|
|
|
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
|
|
|
-
|
|
|
-
|
|
|
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:@"" success:success failure:failure];
|
|
|
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
|
|
|
- [operation resume];
|
|
|
-}
|
|
|
-
|
|
|
- (void)propertiesOfPath:(NSString *)path
|
|
|
onCommunication: (OCCommunication *)sharedOCCommunication
|
|
|
success:(void(^)(NSHTTPURLResponse *, id ))success
|
|
@@ -1223,6 +1206,26 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|
|
[operation resume];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - Trash
|
|
|
+
|
|
|
+- (void)listTrashbinPath:(NSString *)path user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response, NSString *token))success failure:(void(^)(NSHTTPURLResponse *response, id _Nullable responseObject, NSError *, NSString *token))failure
|
|
|
+{
|
|
|
+ NSParameterAssert(success);
|
|
|
+
|
|
|
+ _requestMethod = @"PROPFIND";
|
|
|
+
|
|
|
+ userID = [userID stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
|
|
|
+
|
|
|
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:[NSString stringWithFormat:@"%@/trashbin/%@/trash", path, userID] parameters:nil timeout:k_timeout_webdav];
|
|
|
+
|
|
|
+ [request setHTTPBody:[@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><D:propfind xmlns:D=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><D:prop><D:resourcetype/><D:getlastmodified/><size xmlns=\"http://owncloud.org/ns\"/><favorite xmlns=\"http://owncloud.org/ns\"/><id xmlns=\"http://owncloud.org/ns\"/><D:getcontentlength/><D:getetag/><permissions xmlns=\"http://owncloud.org/ns\"/><D:getcontenttype/><nc:is-encrypted/></D:prop></D:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
|
|
|
+ [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
|
|
|
+
|
|
|
+ OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:@"" success:success failure:failure];
|
|
|
+ [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
|
|
|
+ [operation resume];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Manage Redirections
|
|
|
|
|
|
- (void)setRedirectionBlockOnDatataskWithOCCommunication: (OCCommunication *) sharedOCCommunication andSessionManager:(AFURLSessionManager *) sessionManager{
|