@@ -121,36 +121,36 @@ public Map resources(Map options) throws Exception {
121121 uri .add (resourceType );
122122 if (type != null )
123123 uri .add (type );
124- return callApi (HttpMethod .GET , uri , only (options , "next_cursor" , "direction" , "max_results" , "prefix" , "tags" , "context" , "moderations" ), options );
124+ return callApi (HttpMethod .GET , uri , Cloudinary . only (options , "next_cursor" , "direction" , "max_results" , "prefix" , "tags" , "context" , "moderations" ), options );
125125 }
126126
127127 public Map resourcesByTag (String tag , Map options ) throws Exception {
128128 if (options == null ) options = Cloudinary .emptyMap ();
129129 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
130- return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , "tags" , tag ), only (options , "next_cursor" , "direction" , "max_results" , "tags" , "context" , "moderations" ), options );
130+ return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , "tags" , tag ), Cloudinary . only (options , "next_cursor" , "direction" , "max_results" , "tags" , "context" , "moderations" ), options );
131131 }
132132
133133 public Map resourcesByIds (Iterable <String > publicIds , Map options ) throws Exception {
134134 if (options == null ) options = Cloudinary .emptyMap ();
135135 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
136136 String type = Cloudinary .asString (options .get ("type" ), "upload" );
137- Map params = only (options , "tags" , "context" , "moderations" );
137+ Map params = Cloudinary . only (options , "tags" , "context" , "moderations" );
138138 params .put ("public_ids" , publicIds );
139139 return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , type ), params , options );
140140 }
141141
142142 public Map resourcesByModeration (String kind , String status , Map options ) throws Exception {
143143 if (options == null ) options = Cloudinary .emptyMap ();
144144 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
145- return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , "moderations" , kind , status ), only (options , "next_cursor" , "direction" , "max_results" , "tags" , "context" , "moderations" ), options );
145+ return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , "moderations" , kind , status ), Cloudinary . only (options , "next_cursor" , "direction" , "max_results" , "tags" , "context" , "moderations" ), options );
146146 }
147147
148148 public Map resource (String public_id , Map options ) throws Exception {
149149 if (options == null ) options = Cloudinary .emptyMap ();
150150 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
151151 String type = Cloudinary .asString (options .get ("type" ), "upload" );
152152 return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , type , public_id ),
153- only (options , "exif" , "colors" , "faces" , "image_metadata" , "pages" , "max_results" ), options );
153+ Cloudinary . only (options , "exif" , "colors" , "faces" , "image_metadata" , "pages" , "max_results" ), options );
154154 }
155155
156156 public Map update (String public_id , Map options ) throws Exception {
@@ -168,7 +168,7 @@ public Map deleteResources(Iterable<String> publicIds, Map options) throws Excep
168168 if (options == null ) options = Cloudinary .emptyMap ();
169169 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
170170 String type = Cloudinary .asString (options .get ("type" ), "upload" );
171- Map params = only (options , "keep_original" , "next_cursor" );
171+ Map params = Cloudinary . only (options , "keep_original" , "next_cursor" );
172172 params .put ("public_ids" , publicIds );
173173 return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), params , options );
174174 }
@@ -177,22 +177,22 @@ public Map deleteResourcesByPrefix(String prefix, Map options) throws Exception
177177 if (options == null ) options = Cloudinary .emptyMap ();
178178 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
179179 String type = Cloudinary .asString (options .get ("type" ), "upload" );
180- Map params = only (options , "keep_original" , "next_cursor" );
180+ Map params = Cloudinary . only (options , "keep_original" , "next_cursor" );
181181 params .put ("prefix" , prefix );
182182 return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), params , options );
183183 }
184184
185185 public Map deleteResourcesByTag (String tag , Map options ) throws Exception {
186186 if (options == null ) options = Cloudinary .emptyMap ();
187187 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
188- return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , "tags" , tag ), only (options , "keep_original" , "next_cursor" ), options );
188+ return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , "tags" , tag ), Cloudinary . only (options , "keep_original" , "next_cursor" ), options );
189189 }
190190
191191 public Map deleteAllResources (Map options ) throws Exception {
192192 if (options == null ) options = Cloudinary .emptyMap ();
193193 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
194194 String type = Cloudinary .asString (options .get ("type" ), "upload" );
195- Map filtered = only (options , "keep_original" , "next_cursor" );
195+ Map filtered = Cloudinary . only (options , "keep_original" , "next_cursor" );
196196 filtered .put ("all" , true );
197197 return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), filtered , options );
198198 }
@@ -205,17 +205,17 @@ public Map deleteDerivedResources(Iterable<String> derivedResourceIds, Map optio
205205 public Map tags (Map options ) throws Exception {
206206 if (options == null ) options = Cloudinary .emptyMap ();
207207 String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
208- return callApi (HttpMethod .GET , Arrays .asList ("tags" , resourceType ), only (options , "next_cursor" , "max_results" , "prefix" ), options );
208+ return callApi (HttpMethod .GET , Arrays .asList ("tags" , resourceType ), Cloudinary . only (options , "next_cursor" , "max_results" , "prefix" ), options );
209209 }
210210
211211 public Map transformations (Map options ) throws Exception {
212212 if (options == null ) options = Cloudinary .emptyMap ();
213- return callApi (HttpMethod .GET , Arrays .asList ("transformations" ), only (options , "next_cursor" , "max_results" ), options );
213+ return callApi (HttpMethod .GET , Arrays .asList ("transformations" ), Cloudinary . only (options , "next_cursor" , "max_results" ), options );
214214 }
215215
216216 public Map transformation (String transformation , Map options ) throws Exception {
217217 if (options == null ) options = Cloudinary .emptyMap ();
218- return callApi (HttpMethod .GET , Arrays .asList ("transformations" , transformation ), only (options , "max_results" ), options );
218+ return callApi (HttpMethod .GET , Arrays .asList ("transformations" , transformation ), Cloudinary . only (options , "max_results" ), options );
219219 }
220220
221221 public Map deleteTransformation (String transformation , Map options ) throws Exception {
@@ -300,14 +300,4 @@ protected Map callApi(HttpMethod method, Iterable<String> uri, Map<String, ? ext
300300 throw exceptionConstructor .newInstance (message );
301301 }
302302 }
303-
304- protected Map <String , ? extends Object > only (Map <String , ? extends Object > hash , String ... keys ) {
305- Map <String , Object > result = new HashMap <String , Object >();
306- for (String key : keys ) {
307- if (hash .containsKey (key )) {
308- result .put (key , hash .get (key ));
309- }
310- }
311- return result ;
312- }
313303}
0 commit comments