Skip to content

Commit b288c1e

Browse files
committed
support the restore api
1 parent 3479c24 commit b288c1e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cloudinary-core/src/main/java/com/cloudinary/Api.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,15 @@ public ApiResponse subFolders(String ofFolderPath, Map options) throws Exception
226226
options = ObjectUtils.emptyMap();
227227
return callApi(HttpMethod.GET, Arrays.asList("folders", ofFolderPath), ObjectUtils.emptyMap(), options);
228228
}
229+
230+
public ApiResponse restore(Iterable<String> publicIds, Map options) throws Exception {
231+
if (options == null)
232+
options = ObjectUtils.emptyMap();
233+
String resourceType = ObjectUtils.asString(options.get("resource_type"), "image");
234+
String type = ObjectUtils.asString(options.get("type"), "upload");
235+
Map params = new HashMap<String, Object>();
236+
params.put("public_ids", publicIds);
237+
return callApi(HttpMethod.POST, Arrays.asList("resources", resourceType, type, "restore"), params, options);
238+
}
229239

230240
}

cloudinary-core/src/main/java/com/cloudinary/Cloudinary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Cloudinary {
4141
public final static String SHARED_CDN = AKAMAI_SHARED_CDN;
4242

4343
public final static String VERSION = "1.2.1";
44-
public final static String USER_AGENT = "cld-java-" + VERSION;
44+
public final static String USER_AGENT = "CloudinaryJava/" + VERSION;
4545

4646
public final Configuration config;
4747
private AbstractUploaderStrategy uploaderStrategy;

0 commit comments

Comments
 (0)