@@ -121,36 +121,36 @@ public Map resources(Map options) throws Exception {
121
121
uri .add (resourceType );
122
122
if (type != null )
123
123
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 );
125
125
}
126
126
127
127
public Map resourcesByTag (String tag , Map options ) throws Exception {
128
128
if (options == null ) options = Cloudinary .emptyMap ();
129
129
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 );
131
131
}
132
132
133
133
public Map resourcesByIds (Iterable <String > publicIds , Map options ) throws Exception {
134
134
if (options == null ) options = Cloudinary .emptyMap ();
135
135
String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
136
136
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" );
138
138
params .put ("public_ids" , publicIds );
139
139
return callApi (HttpMethod .GET , Arrays .asList ("resources" , resourceType , type ), params , options );
140
140
}
141
141
142
142
public Map resourcesByModeration (String kind , String status , Map options ) throws Exception {
143
143
if (options == null ) options = Cloudinary .emptyMap ();
144
144
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 );
146
146
}
147
147
148
148
public Map resource (String public_id , Map options ) throws Exception {
149
149
if (options == null ) options = Cloudinary .emptyMap ();
150
150
String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
151
151
String type = Cloudinary .asString (options .get ("type" ), "upload" );
152
152
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 );
154
154
}
155
155
156
156
public Map update (String public_id , Map options ) throws Exception {
@@ -168,7 +168,7 @@ public Map deleteResources(Iterable<String> publicIds, Map options) throws Excep
168
168
if (options == null ) options = Cloudinary .emptyMap ();
169
169
String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
170
170
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" );
172
172
params .put ("public_ids" , publicIds );
173
173
return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), params , options );
174
174
}
@@ -177,22 +177,22 @@ public Map deleteResourcesByPrefix(String prefix, Map options) throws Exception
177
177
if (options == null ) options = Cloudinary .emptyMap ();
178
178
String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
179
179
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" );
181
181
params .put ("prefix" , prefix );
182
182
return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), params , options );
183
183
}
184
184
185
185
public Map deleteResourcesByTag (String tag , Map options ) throws Exception {
186
186
if (options == null ) options = Cloudinary .emptyMap ();
187
187
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 );
189
189
}
190
190
191
191
public Map deleteAllResources (Map options ) throws Exception {
192
192
if (options == null ) options = Cloudinary .emptyMap ();
193
193
String resourceType = Cloudinary .asString (options .get ("resource_type" ), "image" );
194
194
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" );
196
196
filtered .put ("all" , true );
197
197
return callApi (HttpMethod .DELETE , Arrays .asList ("resources" , resourceType , type ), filtered , options );
198
198
}
@@ -205,17 +205,17 @@ public Map deleteDerivedResources(Iterable<String> derivedResourceIds, Map optio
205
205
public Map tags (Map options ) throws Exception {
206
206
if (options == null ) options = Cloudinary .emptyMap ();
207
207
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 );
209
209
}
210
210
211
211
public Map transformations (Map options ) throws Exception {
212
212
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 );
214
214
}
215
215
216
216
public Map transformation (String transformation , Map options ) throws Exception {
217
217
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 );
219
219
}
220
220
221
221
public Map deleteTransformation (String transformation , Map options ) throws Exception {
@@ -300,14 +300,4 @@ protected Map callApi(HttpMethod method, Iterable<String> uri, Map<String, ? ext
300
300
throw exceptionConstructor .newInstance (message );
301
301
}
302
302
}
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
- }
313
303
}
0 commit comments