|
48 | 48 | import com.qcloud.cos.auth.COSSessionCredentials;
|
49 | 49 | import com.qcloud.cos.auth.COSSigner;
|
50 | 50 | import com.qcloud.cos.auth.COSStaticCredentialsProvider;
|
| 51 | +import com.qcloud.cos.endpoint.CIPicRegionEndpointBuilder; |
51 | 52 | import com.qcloud.cos.endpoint.CIRegionEndpointBuilder;
|
52 | 53 | import com.qcloud.cos.endpoint.EndpointBuilder;
|
53 | 54 | import com.qcloud.cos.endpoint.RegionEndpointBuilder;
|
|
64 | 65 | import com.qcloud.cos.http.HttpResponseHandler;
|
65 | 66 | import com.qcloud.cos.internal.BucketNameUtils;
|
66 | 67 | import com.qcloud.cos.internal.CIGetSnapshotResponseHandler;
|
| 68 | +import com.qcloud.cos.internal.CIPicServiceRequest; |
67 | 69 | import com.qcloud.cos.internal.CIServiceRequest;
|
68 | 70 | import com.qcloud.cos.internal.CIWorkflowServiceRequest;
|
69 | 71 | import com.qcloud.cos.internal.COSDefaultAclHeaderHandler;
|
|
107 | 109 | import com.qcloud.cos.model.ciModel.bucket.MediaBucketResponse;
|
108 | 110 | import com.qcloud.cos.model.ciModel.common.ImageProcessRequest;
|
109 | 111 | import com.qcloud.cos.model.ciModel.common.MediaOutputObject;
|
| 112 | +import com.qcloud.cos.model.ciModel.image.GenerateQrcodeRequest; |
110 | 113 | import com.qcloud.cos.model.ciModel.image.ImageLabelRequest;
|
111 | 114 | import com.qcloud.cos.model.ciModel.image.ImageLabelResponse;
|
112 | 115 | import com.qcloud.cos.model.ciModel.image.ImageLabelV2Request;
|
113 | 116 | import com.qcloud.cos.model.ciModel.image.ImageLabelV2Response;
|
114 | 117 | import com.qcloud.cos.model.ciModel.image.ImageSearchRequest;
|
115 | 118 | import com.qcloud.cos.model.ciModel.image.ImageSearchResponse;
|
| 119 | +import com.qcloud.cos.model.ciModel.image.ImageStyleRequest; |
| 120 | +import com.qcloud.cos.model.ciModel.image.ImageStyleResponse; |
116 | 121 | import com.qcloud.cos.model.ciModel.image.OpenImageSearchRequest;
|
117 | 122 | import com.qcloud.cos.model.ciModel.job.DocHtmlRequest;
|
118 | 123 | import com.qcloud.cos.model.ciModel.job.DocJobListRequest;
|
@@ -526,6 +531,8 @@ private <X extends CosServiceRequest> void buildUrlAndHost(CosHttpRequest<X> req
|
526 | 531 | bucket = formatBucket(bucket, fetchCredential().getCOSAppId());
|
527 | 532 | if (isCIRequest) {
|
528 | 533 | endpoint = new CIRegionEndpointBuilder(clientConfig.getRegion()).buildGeneralApiEndpoint(bucket);
|
| 534 | + } else if (request.getOriginalRequest() instanceof CIPicServiceRequest) { |
| 535 | + endpoint = new CIPicRegionEndpointBuilder(clientConfig.getRegion()).buildGeneralApiEndpoint(bucket); |
529 | 536 | } else {
|
530 | 537 | endpoint = clientConfig.getEndpointBuilder().buildGeneralApiEndpoint(bucket);
|
531 | 538 | }
|
@@ -4234,7 +4241,7 @@ public PutAsyncFetchTaskResult putAsyncFetchTask(PutAsyncFetchTaskRequest putAsy
|
4234 | 4241 | CosHttpRequest<PutAsyncFetchTaskRequest> request = createRequest(putAsyncFetchTaskRequest.getBucketName(),
|
4235 | 4242 | String.format("/%s/", putAsyncFetchTaskRequest.getBucketName()), putAsyncFetchTaskRequest, HttpMethodName.POST);
|
4236 | 4243 | PutAsyncFetchTaskSerializer serializer = new PutAsyncFetchTaskSerializer(PutAsyncFetchTaskRequest.class);
|
4237 |
| - SimpleModule module = |
| 4244 | + SimpleModule module = |
4238 | 4245 | new SimpleModule("PutAsyncFetchTaskSerializer", new Version(1, 0, 0, null, null, null));
|
4239 | 4246 | module.addSerializer(PutAsyncFetchTaskRequest.class, serializer);
|
4240 | 4247 |
|
@@ -4379,5 +4386,58 @@ public InputStream getSnapshot(CosSnapshotRequest snapshotRequest) {
|
4379 | 4386 | return this.invoke(request, new CIGetSnapshotResponseHandler());
|
4380 | 4387 | }
|
4381 | 4388 |
|
| 4389 | + @Override |
| 4390 | + public String generateQrcode(GenerateQrcodeRequest generateQrcodeRequest) { |
| 4391 | + rejectNull(generateQrcodeRequest, |
| 4392 | + "The request parameter must be specified setting the object tags"); |
| 4393 | + rejectNull(generateQrcodeRequest.getBucketName(), |
| 4394 | + "The bucketName parameter must be specified setting the object tags"); |
| 4395 | + CosHttpRequest<GenerateQrcodeRequest> request = this.createRequest(generateQrcodeRequest.getBucketName(), "/", generateQrcodeRequest, HttpMethodName.GET); |
| 4396 | + addParameterIfNotNull(request, "ci-process", "qrcode-generate"); |
| 4397 | + addParameterIfNotNull(request, "qrcode-content", generateQrcodeRequest.getQrcodeContent()); |
| 4398 | + addParameterIfNotNull(request, "mode", generateQrcodeRequest.getMode()); |
| 4399 | + addParameterIfNotNull(request, "width", generateQrcodeRequest.getWidth()); |
| 4400 | + return this.invoke(request, new Unmarshallers.GenerateQrcodeUnmarshaller()); |
| 4401 | + } |
| 4402 | + |
| 4403 | + @Override |
| 4404 | + public Boolean addImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4405 | + rejectNull(imageStyleRequest, |
| 4406 | + "The request parameter must be specified setting the object tags"); |
| 4407 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4408 | + "The bucketName parameter must be specified setting the object tags"); |
| 4409 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.PUT); |
| 4410 | + request.addParameter("style", ""); |
| 4411 | + this.setContent(request, CImageXmlFactory.addStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4412 | + invoke(request, voidCosResponseHandler); |
| 4413 | + return true; |
| 4414 | + } |
| 4415 | + |
| 4416 | + @Override |
| 4417 | + public ImageStyleResponse getImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4418 | + rejectNull(imageStyleRequest, |
| 4419 | + "The request parameter must be specified setting the object tags"); |
| 4420 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4421 | + "The bucketName parameter must be specified setting the object tags"); |
| 4422 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.GET); |
| 4423 | + request.addParameter("style", ""); |
| 4424 | + this.setContent(request, CImageXmlFactory.getStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4425 | + invoke(request, new Unmarshallers.getImageStyleUnmarshaller()); |
| 4426 | + return null; |
| 4427 | + } |
| 4428 | + |
| 4429 | + @Override |
| 4430 | + public Boolean deleteImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4431 | + rejectNull(imageStyleRequest, |
| 4432 | + "The request parameter must be specified setting the object tags"); |
| 4433 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4434 | + "The bucketName parameter must be specified setting the object tags"); |
| 4435 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.DELETE); |
| 4436 | + request.addParameter("style", ""); |
| 4437 | + this.setContent(request, CImageXmlFactory.deleteStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4438 | + invoke(request, voidCosResponseHandler); |
| 4439 | + return true; |
| 4440 | + } |
| 4441 | + |
4382 | 4442 | }
|
4383 | 4443 |
|
0 commit comments