|
@@ -2872,6 +2872,37 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+- (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 {
|
|
|
+
|
|
|
+ serverPath = [serverPath stringByAppendingString:k_url_create_new_mobile_richdocuments];
|
|
|
+ serverPath = [serverPath stringByAppendingString:@"?format=json"];
|
|
|
+
|
|
|
+ OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
|
|
|
+ request = [self getRequestWithCredentials:request];
|
|
|
+
|
|
|
+ [request createNewRichdocuments:serverPath path:path templateID:templateID onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
|
|
|
+
|
|
|
+ NSData *responseData = (NSData*) response;
|
|
|
+
|
|
|
+ //Parse
|
|
|
+ NSError *error;
|
|
|
+ NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
|
|
|
+ NSLog(@"[LOG] URL Asset : %@",jsongParsed);
|
|
|
+
|
|
|
+ if (jsongParsed && jsongParsed.allKeys > 0) {
|
|
|
+
|
|
|
+ NSString *url = [jsongParsed valueForKey:@"url"];
|
|
|
+ successRequest(response, url, request.redirectedServer);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
|
|
|
+
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
- (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 {
|
|
|
|
|
|
serverPath = [serverPath stringByAppendingString:k_url_insert_assets_to_richdocuments];
|