鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc
以下内容为反编译后的 TemplateManager.java 源代码,内容仅作参考
package com.qiniu.qvs;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.qvs.model.PatchOperation;
import com.qiniu.qvs.model.Template;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;
import com.qiniu.util.UrlUtils;
import com.tencent.open.SocialConstants;
public class TemplateManager {
private final String apiServer;
private final Auth auth;
private final Client client;
public TemplateManager(Auth auth) {
this(auth, "http://qvs.qiniuapi.com");
}
public Response createTemplate(Template template) throws QiniuException {
StringMap stringMap = new StringMap();
stringMap.putNotNull("name", template.getName());
stringMap.putNotNull(SocialConstants.PARAM_APP_DESC, template.getDesc());
stringMap.putNotNull("bucket", template.getBucket());
stringMap.putNotNull("deleteAfterDays", Integer.valueOf(template.getDeleteAfterDays()));
stringMap.putNotNull("fileType", Integer.valueOf(template.getFileType()));
stringMap.putNotNull("recordFileFormat", Integer.valueOf(template.getRecordFileFormat()));
stringMap.putNotNull("templateType", Integer.valueOf(template.getTemplateType()));
stringMap.putNotNull("recordInterval", Integer.valueOf(template.getRecordInterval()));
stringMap.putNotNull("snapInterval", Integer.valueOf(template.getSnapInterval()));
stringMap.putNotNull("recordType", Integer.valueOf(template.getRecordType()));
stringMap.putNotNull("jpgOverwriteStatus", Boolean.valueOf(template.isJpgOverwriteStatus()));
stringMap.putNotNull("jpgSequenceStatus", Boolean.valueOf(template.isJpgSequenceStatus()));
stringMap.putNotNull("jpgOnDemandStatus", Boolean.valueOf(template.isJpgOnDemandStatus()));
return QvsResponse.post(String.format("%s/v1/templates", this.apiServer), stringMap, this.client, this.auth);
}
public Response deleteTemplate(String str) throws QiniuException {
return QvsResponse.delete(String.format("%s/v1/templates/%s", this.apiServer, str), this.client, this.auth);
}
public Response listTemplate(int i9, int i10, int i11, String str) throws QiniuException {
return QvsResponse.get(UrlUtils.composeUrlWithQueries(String.format("%s/v1/templates", this.apiServer), new StringMap().put("offset", Integer.valueOf(i9)).put("line", Integer.valueOf(i10)).put("templateType", Integer.valueOf(i11)).putNotEmpty("match", str)), this.client, this.auth);
}
public Response queryTemplate(String str) throws QiniuException {
return QvsResponse.get(String.format("%s/v1/templates/%s", this.apiServer, str), this.client, this.auth);
}
public Response updateTemplate(String str, PatchOperation[] patchOperationArr) throws QiniuException {
return QvsResponse.patch(String.format("%s/v1/templates/%s", this.apiServer, str), new StringMap().put("operations", patchOperationArr), this.client, this.auth);
}
public TemplateManager(Auth auth, String str) {
this(auth, str, new Client());
}
public TemplateManager(Auth auth, String str, Client client) {
this.auth = auth;
this.apiServer = str;
this.client = client;
}
}