|
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 | } |
@@ -4203,7 +4210,7 @@ public PutAsyncFetchTaskResult putAsyncFetchTask(PutAsyncFetchTaskRequest putAsy |
4203 | 4210 | CosHttpRequest<PutAsyncFetchTaskRequest> request = createRequest(putAsyncFetchTaskRequest.getBucketName(), |
4204 | 4211 | String.format("/%s/", putAsyncFetchTaskRequest.getBucketName()), putAsyncFetchTaskRequest, HttpMethodName.POST); |
4205 | 4212 | PutAsyncFetchTaskSerializer serializer = new PutAsyncFetchTaskSerializer(PutAsyncFetchTaskRequest.class); |
4206 | | - SimpleModule module = |
| 4213 | + SimpleModule module = |
4207 | 4214 | new SimpleModule("PutAsyncFetchTaskSerializer", new Version(1, 0, 0, null, null, null)); |
4208 | 4215 | module.addSerializer(PutAsyncFetchTaskRequest.class, serializer); |
4209 | 4216 |
|
@@ -4348,5 +4355,58 @@ public InputStream getSnapshot(CosSnapshotRequest snapshotRequest) { |
4348 | 4355 | return this.invoke(request, new CIGetSnapshotResponseHandler()); |
4349 | 4356 | } |
4350 | 4357 |
|
| 4358 | + @Override |
| 4359 | + public String generateQrcode(GenerateQrcodeRequest generateQrcodeRequest) { |
| 4360 | + rejectNull(generateQrcodeRequest, |
| 4361 | + "The request parameter must be specified setting the object tags"); |
| 4362 | + rejectNull(generateQrcodeRequest.getBucketName(), |
| 4363 | + "The bucketName parameter must be specified setting the object tags"); |
| 4364 | + CosHttpRequest<GenerateQrcodeRequest> request = this.createRequest(generateQrcodeRequest.getBucketName(), "/", generateQrcodeRequest, HttpMethodName.GET); |
| 4365 | + addParameterIfNotNull(request, "ci-process", "qrcode-generate"); |
| 4366 | + addParameterIfNotNull(request, "qrcode-content", generateQrcodeRequest.getQrcodeContent()); |
| 4367 | + addParameterIfNotNull(request, "mode", generateQrcodeRequest.getMode()); |
| 4368 | + addParameterIfNotNull(request, "width", generateQrcodeRequest.getWidth()); |
| 4369 | + return this.invoke(request, new Unmarshallers.GenerateQrcodeUnmarshaller()); |
| 4370 | + } |
| 4371 | + |
| 4372 | + @Override |
| 4373 | + public Boolean addImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4374 | + rejectNull(imageStyleRequest, |
| 4375 | + "The request parameter must be specified setting the object tags"); |
| 4376 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4377 | + "The bucketName parameter must be specified setting the object tags"); |
| 4378 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.PUT); |
| 4379 | + request.addParameter("style", ""); |
| 4380 | + this.setContent(request, CImageXmlFactory.addStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4381 | + invoke(request, voidCosResponseHandler); |
| 4382 | + return true; |
| 4383 | + } |
| 4384 | + |
| 4385 | + @Override |
| 4386 | + public ImageStyleResponse getImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4387 | + rejectNull(imageStyleRequest, |
| 4388 | + "The request parameter must be specified setting the object tags"); |
| 4389 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4390 | + "The bucketName parameter must be specified setting the object tags"); |
| 4391 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.GET); |
| 4392 | + request.addParameter("style", ""); |
| 4393 | + this.setContent(request, CImageXmlFactory.getStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4394 | + invoke(request, new Unmarshallers.getImageStyleUnmarshaller()); |
| 4395 | + return null; |
| 4396 | + } |
| 4397 | + |
| 4398 | + @Override |
| 4399 | + public Boolean deleteImageStyle(ImageStyleRequest imageStyleRequest) { |
| 4400 | + rejectNull(imageStyleRequest, |
| 4401 | + "The request parameter must be specified setting the object tags"); |
| 4402 | + rejectNull(imageStyleRequest.getBucketName(), |
| 4403 | + "The bucketName parameter must be specified setting the object tags"); |
| 4404 | + CosHttpRequest<ImageStyleRequest> request = createRequest(imageStyleRequest.getBucketName(), "/", imageStyleRequest, HttpMethodName.DELETE); |
| 4405 | + request.addParameter("style", ""); |
| 4406 | + this.setContent(request, CImageXmlFactory.deleteStyleConvertToXmlByteArray(imageStyleRequest), "application/xml", false); |
| 4407 | + invoke(request, voidCosResponseHandler); |
| 4408 | + return true; |
| 4409 | + } |
| 4410 | + |
4351 | 4411 | } |
4352 | 4412 |
|
0 commit comments