com.cloudinary.Util类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(496)

本文整理了Java中com.cloudinary.Util类的一些代码示例,展示了Util类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util类的具体详情如下:
包路径:com.cloudinary.Util
类名称:Util

Util介绍

暂无

代码示例

代码示例来源:origin: com.cloudinary/cloudinary

public ApiResponse updateUploadPreset(String name, Map options) throws Exception {
  if (options == null) options = Cloudinary.emptyMap();
  Map params = Util.buildUploadParams(options);
  Util.clearEmpty(params);
  params.putAll(Cloudinary.only(options, "unsigned", "disallow_public_id"));
  return callApi(HttpMethod.PUT, Arrays.asList("upload_presets", name), params, options);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

@SuppressWarnings("unchecked")
public static final void processWriteParameters(Map<String, Object> options, Map<String, Object> params) {
  if (options.get("headers") != null)
    params.put("headers", buildCustomHeaders(options.get("headers")));
  if (options.get("tags") != null)
    params.put("tags", StringUtils.join(ObjectUtils.asArray(options.get("tags")), ","));
  if (options.get("face_coordinates") != null)
    params.put("face_coordinates", Coordinates.parseCoordinates(options.get("face_coordinates")).toString());
  if (options.get("custom_coordinates") != null)
    params.put("custom_coordinates", Coordinates.parseCoordinates(options.get("custom_coordinates")).toString());
  if (options.get("context") != null)
    params.put("context", encodeContext(options.get("context")));
  if (options.get("access_control") != null) {
    params.put("access_control", encodeAccessControl(options.get("access_control")));
  }
  putObject("ocr", options, params);
  putObject("raw_convert", options, params);
  putObject("categorization", options, params);
  putObject("detection", options, params);
  putObject("similarity_search", options, params);
  putObject("background_removal", options, params);
  if (options.get("auto_tagging") != null)
    params.put("auto_tagging", ObjectUtils.asFloat(options.get("auto_tagging")));
}

代码示例来源:origin: com.cloudinary/cloudinary-core

private static void putEager(String name, Map from, Map<String, Object> to) {
  final Object transformations = from.get(name);
  if (transformations != null)
    to.put(name, buildEager((List<Transformation>) transformations));
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public void signRequest(Map<String, Object> params, Map<String, Object> options) {
  String apiKey = ObjectUtils.asString(options.get("api_key"), this.config.apiKey);
  if (apiKey == null)
    throw new IllegalArgumentException("Must supply api_key");
  String apiSecret = ObjectUtils.asString(options.get("api_secret"), this.config.apiSecret);
  if (apiSecret == null)
    throw new IllegalArgumentException("Must supply api_secret");
  Util.clearEmpty(params);
  params.put("signature", this.apiSignRequest(params, apiSecret));
  params.put("api_key", apiKey);
}

代码示例来源:origin: cloudinary/cloudinary_java

params.put("type", (String) options.get("type"));
for (String attr : BOOLEAN_UPLOAD_OPTIONS) {
  putBoolean(attr, options, params);
  putEager("eager", options, params);
  Object transformation = options.get("transformation");
  if (transformation != null) {
  processWriteParameters(options, params);
} else {

代码示例来源:origin: com.cloudinary/cloudinary

public Map explicit(String publicId, Map options) throws IOException {
  if (options == null) options = Cloudinary.emptyMap();
  Map<String, Object> params = new HashMap<String, Object>();
  params.put("public_id", publicId);
  params.put("callback", (String) options.get("callback"));
  params.put("type", (String) options.get("type"));
  params.put("eager", Util.buildEager((List<Transformation>) options.get("eager")));
  params.put("headers", Util.buildCustomHeaders(options.get("headers")));
  params.put("tags", StringUtils.join(Cloudinary.asArray(options.get("tags")), ","));
  if (options.get("face_coordinates") != null) {
    params.put("face_coordinates", Coordinates.parseCoordinates(options.get("face_coordinates")).toString());
  }
  if (options.get("custom_coordinates") != null) {
    params.put("custom_coordinates", Coordinates.parseCoordinates(options.get("custom_coordinates")).toString());
  }
  if (options.get("context") != null) {
    params.put("context", Cloudinary.encodeMap(options.get("context")));
  }
  return callApi("explicit", params, options, null);
}

代码示例来源:origin: com.cloudinary/cloudinary

params.put(attr, value.toString());            
params.put("eager", buildEager((List<Transformation>) options.get("eager")));
params.put("notification_url", (String) options.get("notification_url"));
params.put("eager_notification_url", (String) options.get("eager_notification_url"));
params.put("upload_preset", options.get("upload_preset"));
processWriteParameters(options, params);
return params;

代码示例来源:origin: com.cloudinary/cloudinary-core

public ApiResponse update(String public_id, Map options) throws Exception {
  if (options == null) options = ObjectUtils.emptyMap();
  String resourceType = ObjectUtils.asString(options.get("resource_type"), "image");
  String type = ObjectUtils.asString(options.get("type"), "upload");
  Map params = new HashMap<String, Object>();
  Util.processWriteParameters(options, params);
  params.put("moderation_status", options.get("moderation_status"));
  params.put("notification_url", options.get("notification_url"));
  ApiResponse response = callApi(HttpMethod.POST, Arrays.asList("resources", resourceType, type, public_id),
      params, options);
  return response;
}

代码示例来源:origin: cloudinary/cloudinary_java

protected Map callContextApi(Map context, String command, String[] publicIds, Map options) throws IOException {
  return callContextApi(Util.encodeContext(context), command, publicIds, options);
}

代码示例来源:origin: cloudinary/cloudinary_java

public Map<String, Object> buildUploadParams(Map options) {
  return Util.buildUploadParams(options);
}

代码示例来源:origin: com.cloudinary/cloudinary

protected static final void processWriteParameters(
    Map<String, Object> options, Map<String, Object> params) {
  if (options.get("headers") != null)
    params.put("headers", buildCustomHeaders(options.get("headers")));
  if (options.get("tags") != null)
    params.put("tags", StringUtils.join(

代码示例来源:origin: com.cloudinary/cloudinary-core

public Map createArchive(Map options, String targetFormat) throws IOException {
  Map params = Util.buildArchiveParams(options, targetFormat);
  return callApi("generate_archive", params, options, null);
}

代码示例来源:origin: cloudinary/cloudinary_java

public void signRequest(Map<String, Object> params, Map<String, Object> options) {
  String apiKey = ObjectUtils.asString(options.get("api_key"), this.config.apiKey);
  if (apiKey == null)
    throw new IllegalArgumentException("Must supply api_key");
  String apiSecret = ObjectUtils.asString(options.get("api_secret"), this.config.apiSecret);
  if (apiSecret == null)
    throw new IllegalArgumentException("Must supply api_secret");
  Util.clearEmpty(params);
  params.put("signature", this.apiSignRequest(params, apiSecret));
  params.put("api_key", apiKey);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

params.put("type", (String) options.get("type"));
for (String attr : BOOLEAN_UPLOAD_OPTIONS) {
  putBoolean(attr, options, params);
  putEager("eager", options, params);
  Object transformation = options.get("transformation");
  if (transformation != null) {
  processWriteParameters(options, params);
} else {

代码示例来源:origin: com.cloudinary/cloudinary

public ApiResponse update(String public_id, Map options) throws Exception {
  if (options == null) options = Cloudinary.emptyMap();
  String resourceType = Cloudinary.asString(options.get("resource_type"), "image");
  String type = Cloudinary.asString(options.get("type"), "upload");
  Map params = new HashMap<String, Object>();
  Util.processWriteParameters(options, params);
  params.put("moderation_status", options.get("moderation_status"));
  return callApi(HttpMethod.POST, Arrays.asList("resources", resourceType, type, public_id), 
      params, options);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

protected Map callContextApi(Map context, String command, String[] publicIds, Map options) throws IOException {
  return callContextApi(Util.encodeContext(context), command, publicIds, options);
}

代码示例来源:origin: com.cloudinary/cloudinary-core

public Map<String, Object> buildUploadParams(Map options) {
  return Util.buildUploadParams(options);
}

代码示例来源:origin: cloudinary/cloudinary_java

public Map createArchive(Map options, String targetFormat) throws IOException {
  Map params = Util.buildArchiveParams(options, targetFormat);
  return callApi("generate_archive", params, options, null);
}

代码示例来源:origin: com.cloudinary/cloudinary

public ApiResponse createUploadPreset(Map options) throws Exception {
  if (options == null) options = Cloudinary.emptyMap();
  Map params = Util.buildUploadParams(options);
  Util.clearEmpty(params);
  params.putAll(Cloudinary.only(options, "name", "unsigned", "disallow_public_id"));
  return callApi(HttpMethod.POST,  Arrays.asList("upload_presets"), params, options);
}

代码示例来源:origin: com.cloudinary/cloudinary

public void signRequest(Map<String, Object> params, Map<String, Object> options) {
  String apiKey = Cloudinary.asString(options.get("api_key"), this.getStringConfig("api_key"));
  if (apiKey == null)
    throw new IllegalArgumentException("Must supply api_key");
  String apiSecret = Cloudinary.asString(options.get("api_secret"), this.getStringConfig("api_secret"));
  if (apiSecret == null)
    throw new IllegalArgumentException("Must supply api_secret");
  Util.clearEmpty(params);
  params.put("signature", this.apiSignRequest(params, apiSecret));
  params.put("api_key", apiKey);
}

相关文章