44
55import com .cloudinary .api .ApiResponse ;
66import com .cloudinary .api .AuthorizationRequired ;
7- import com .cloudinary .api .exceptions .AlreadyExists ;
8- import com .cloudinary .api .exceptions .BadRequest ;
9- import com .cloudinary .api .exceptions .GeneralError ;
10- import com .cloudinary .api .exceptions .NotAllowed ;
11- import com .cloudinary .api .exceptions .NotFound ;
12- import com .cloudinary .api .exceptions .RateLimited ;
7+ import com .cloudinary .api .exceptions .*;
138import com .cloudinary .strategies .AbstractApiStrategy ;
149import com .cloudinary .utils .ObjectUtils ;
1510import com .cloudinary .utils .StringUtils ;
@@ -473,10 +468,19 @@ public ApiResponse updateStreamingProfile(String name, String displayName, List<
473468 * Update access mode of one or more resources by prefix
474469 *
475470 * @param accessMode The new access mode, "public" or "authenticated"
476- * @param prefix The prefix by which to filter applicable resources
477- * @param options
478- * @return
479- * @throws Exception
471+ * @param prefix The prefix by which to filter applicable resources
472+ * @param options additional options
473+ * <ul>
474+ * <li>resource_type - (default "image") - the type of resources to modify</li>
475+ * <li>max_results - optional - the maximum resources to process in a single invocation</li>
476+ * <li>next_cursor - optional - provided by a previous call to the method</li>
477+ * </ul>
478+ * @return a map of the returned values
479+ * <ul>
480+ * <li>updated - an array of resources</li>
481+ * <li>next_cursor - optional - provided if more resources can be processed</li>
482+ * </ul>
483+ * @throws ApiException an API exception
480484 */
481485 public ApiResponse updateResourcesAccessModeByPrefix (String accessMode , String prefix , Map options ) throws Exception {
482486 return updateResourcesAccessMode (accessMode , "prefix" , prefix , options );
@@ -486,10 +490,19 @@ public ApiResponse updateResourcesAccessModeByPrefix(String accessMode, String p
486490 * Update access mode of one or more resources by tag
487491 *
488492 * @param accessMode The new access mode, "public" or "authenticated"
489- * @param tag The tag by which to filter applicable resources
490- * @param options
491- * @return
492- * @throws Exception
493+ * @param tag The tag by which to filter applicable resources
494+ * @param options additional options
495+ * <ul>
496+ * <li>resource_type - (default "image") - the type of resources to modify</li>
497+ * <li>max_results - optional - the maximum resources to process in a single invocation</li>
498+ * <li>next_cursor - optional - provided by a previous call to the method</li>
499+ * </ul>
500+ * @return a map of the returned values
501+ * <ul>
502+ * <li>updated - an array of resources</li>
503+ * <li>next_cursor - optional - provided if more resources can be processed</li>
504+ * </ul>
505+ * @throws ApiException an API exception
493506 */
494507 public ApiResponse updateResourcesAccessModeByTag (String accessMode , String tag , Map options ) throws Exception {
495508 return updateResourcesAccessMode (accessMode , "tag" , tag , options );
@@ -499,10 +512,19 @@ public ApiResponse updateResourcesAccessModeByTag(String accessMode, String tag,
499512 * Update access mode of one or more resources by publicIds
500513 *
501514 * @param accessMode The new access mode, "public" or "authenticated"
502- * @param publicIds A list of public ids of resources to be updated
503- * @param options
504- * @return
505- * @throws Exception
515+ * @param publicIds A list of public ids of resources to be updated
516+ * @param options additional options
517+ * <ul>
518+ * <li>resource_type - (default "image") - the type of resources to modify</li>
519+ * <li>max_results - optional - the maximum resources to process in a single invocation</li>
520+ * <li>next_cursor - optional - provided by a previous call to the method</li>
521+ * </ul>
522+ * @return a map of the returned values
523+ * <ul>
524+ * <li>updated - an array of resources</li>
525+ * <li>next_cursor - optional - provided if more resources can be processed</li>
526+ * </ul>
527+ * @throws ApiException an API exception
506528 */
507529 public ApiResponse updateResourcesAccessModeByIds (String accessMode , Iterable <String > publicIds , Map options ) throws Exception {
508530 return updateResourcesAccessMode (accessMode , "public_ids" , publicIds , options );
@@ -511,15 +533,12 @@ public ApiResponse updateResourcesAccessModeByIds(String accessMode, Iterable<St
511533 private ApiResponse updateResourcesAccessMode (String accessMode , String byKey , Object value , Map options ) throws Exception {
512534 if (options == null ) options = ObjectUtils .emptyMap ();
513535 String resourceType = ObjectUtils .asString (options .get ("resource_type" ), "image" );
514- List <String > uri = new ArrayList <String >();
515- uri .add ("resources" );
516- uri .add (resourceType );
517- uri .add (ObjectUtils .asString (options .get ("type" ), "upload" ));
518- uri .add ("update_access_mode" );
519- Map params = new HashMap <String , Object >();
536+ String type = ObjectUtils .asString (options .get ("type" ), "upload" );
537+ List <String > uri = Arrays .asList ("resources" , resourceType , type , "update_access_mode" );
538+ Map params = ObjectUtils .only (options , "next_cursor" , "max_results" );
520539 params .put ("access_mode" , accessMode );
521540 params .put (byKey , value );
522- return callApi (HttpMethod .POST , uri , params , ObjectUtils . only ( options , "next_cursor" ) );
541+ return callApi (HttpMethod .POST , uri , params , options );
523542 }
524543
525544}
0 commit comments