in aigen-20240111/src/aigen_20240111.cpp [597:766]
InteractiveScribbleSegmentationResponse Alibabacloud_Aigen20240111::Client::interactiveScribbleSegmentationAdvance(shared_ptr<InteractiveScribbleSegmentationAdvanceRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime) {
// Step 0: init client
shared_ptr<string> accessKeyId = make_shared<string>(_credential->getAccessKeyId());
shared_ptr<string> accessKeySecret = make_shared<string>(_credential->getAccessKeySecret());
shared_ptr<string> securityToken = make_shared<string>(_credential->getSecurityToken());
shared_ptr<string> credentialType = make_shared<string>(_credential->getType());
shared_ptr<string> openPlatformEndpoint = _openPlatformEndpoint;
if (Darabonba_Util::Client::isUnset<string>(openPlatformEndpoint)) {
openPlatformEndpoint = make_shared<string>("openplatform.aliyuncs.com");
}
if (Darabonba_Util::Client::isUnset<string>(credentialType)) {
credentialType = make_shared<string>("access_key");
}
shared_ptr<Alibabacloud_OpenApi::Config> authConfig = make_shared<Alibabacloud_OpenApi::Config>(map<string, boost::any>({
{"accessKeyId", !accessKeyId ? boost::any() : boost::any(*accessKeyId)},
{"accessKeySecret", !accessKeySecret ? boost::any() : boost::any(*accessKeySecret)},
{"securityToken", !securityToken ? boost::any() : boost::any(*securityToken)},
{"type", !credentialType ? boost::any() : boost::any(*credentialType)},
{"endpoint", !openPlatformEndpoint ? boost::any() : boost::any(*openPlatformEndpoint)},
{"protocol", !_protocol ? boost::any() : boost::any(*_protocol)},
{"regionId", !_regionId ? boost::any() : boost::any(*_regionId)}
}));
shared_ptr<Alibabacloud_OpenPlatform20191219::Client> authClient = make_shared<Alibabacloud_OpenPlatform20191219::Client>(authConfig);
shared_ptr<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadRequest> authRequest = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadRequest>(map<string, boost::any>({
{"product", boost::any(string("aigen"))},
{"regionId", !_regionId ? boost::any() : boost::any(*_regionId)}
}));
shared_ptr<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse> authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>();
shared_ptr<Alibabacloud_OSS::Config> ossConfig = make_shared<Alibabacloud_OSS::Config>(map<string, boost::any>({
{"accessKeySecret", !accessKeySecret ? boost::any() : boost::any(*accessKeySecret)},
{"type", boost::any(string("access_key"))},
{"protocol", !_protocol ? boost::any() : boost::any(*_protocol)},
{"regionId", !_regionId ? boost::any() : boost::any(*_regionId)}
}));
shared_ptr<Alibabacloud_OSS::Client> ossClient;
shared_ptr<Darabonba_FileForm::FileField> fileObj = make_shared<Darabonba_FileForm::FileField>();
shared_ptr<Alibabacloud_OSS::PostObjectRequestHeader> ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>();
shared_ptr<Alibabacloud_OSS::PostObjectRequest> uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>();
shared_ptr<Alibabacloud_OSSUtil::RuntimeOptions> ossRuntime = make_shared<Alibabacloud_OSSUtil::RuntimeOptions>();
Alibabacloud_OpenApiUtil::Client::convert(runtime, ossRuntime);
shared_ptr<InteractiveScribbleSegmentationRequest> interactiveScribbleSegmentationReq = make_shared<InteractiveScribbleSegmentationRequest>();
Alibabacloud_OpenApiUtil::Client::convert(request, interactiveScribbleSegmentationReq);
if (!Darabonba_Util::Client::isUnset<Darabonba::Stream>(request->imageUrlObject)) {
authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>(authClient->authorizeFileUploadWithOptions(authRequest, runtime));
ossConfig->accessKeyId = authResponse->body->accessKeyId;
ossConfig->endpoint = make_shared<string>(Alibabacloud_OpenApiUtil::Client::getEndpoint(authResponse->body->endpoint, authResponse->body->useAccelerate, _endpointType));
ossClient = make_shared<Alibabacloud_OSS::Client>(ossConfig);
fileObj = make_shared<Darabonba_FileForm::FileField>(map<string, boost::any>({
{"filename", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"content", !request->imageUrlObject ? boost::any() : boost::any(*request->imageUrlObject)},
{"contentType", boost::any(string(""))}
}));
ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>(map<string, boost::any>({
{"accessKeyId", !authResponse->body->accessKeyId ? boost::any() : boost::any(*authResponse->body->accessKeyId)},
{"policy", !authResponse->body->encodedPolicy ? boost::any() : boost::any(*authResponse->body->encodedPolicy)},
{"signature", !authResponse->body->signature ? boost::any() : boost::any(*authResponse->body->signature)},
{"key", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"file", !fileObj ? boost::any() : boost::any(*fileObj)},
{"successActionStatus", boost::any(string("201"))}
}));
uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>(map<string, boost::any>({
{"bucketName", !authResponse->body->bucket ? boost::any() : boost::any(*authResponse->body->bucket)},
{"header", !ossHeader ? boost::any() : boost::any(*ossHeader)}
}));
ossClient->postObject(uploadRequest, ossRuntime);
interactiveScribbleSegmentationReq->imageUrl = make_shared<string>(string("http://") + string(*authResponse->body->bucket) + string(".") + string(*authResponse->body->endpoint) + string("/") + string(*authResponse->body->objectKey));
}
if (!Darabonba_Util::Client::isUnset<Darabonba::Stream>(request->integratedMaskUrlObject)) {
authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>(authClient->authorizeFileUploadWithOptions(authRequest, runtime));
ossConfig->accessKeyId = authResponse->body->accessKeyId;
ossConfig->endpoint = make_shared<string>(Alibabacloud_OpenApiUtil::Client::getEndpoint(authResponse->body->endpoint, authResponse->body->useAccelerate, _endpointType));
ossClient = make_shared<Alibabacloud_OSS::Client>(ossConfig);
fileObj = make_shared<Darabonba_FileForm::FileField>(map<string, boost::any>({
{"filename", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"content", !request->integratedMaskUrlObject ? boost::any() : boost::any(*request->integratedMaskUrlObject)},
{"contentType", boost::any(string(""))}
}));
ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>(map<string, boost::any>({
{"accessKeyId", !authResponse->body->accessKeyId ? boost::any() : boost::any(*authResponse->body->accessKeyId)},
{"policy", !authResponse->body->encodedPolicy ? boost::any() : boost::any(*authResponse->body->encodedPolicy)},
{"signature", !authResponse->body->signature ? boost::any() : boost::any(*authResponse->body->signature)},
{"key", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"file", !fileObj ? boost::any() : boost::any(*fileObj)},
{"successActionStatus", boost::any(string("201"))}
}));
uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>(map<string, boost::any>({
{"bucketName", !authResponse->body->bucket ? boost::any() : boost::any(*authResponse->body->bucket)},
{"header", !ossHeader ? boost::any() : boost::any(*ossHeader)}
}));
ossClient->postObject(uploadRequest, ossRuntime);
interactiveScribbleSegmentationReq->integratedMaskUrl = make_shared<string>(string("http://") + string(*authResponse->body->bucket) + string(".") + string(*authResponse->body->endpoint) + string("/") + string(*authResponse->body->objectKey));
}
if (!Darabonba_Util::Client::isUnset<Darabonba::Stream>(request->maskImageUrlObject)) {
authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>(authClient->authorizeFileUploadWithOptions(authRequest, runtime));
ossConfig->accessKeyId = authResponse->body->accessKeyId;
ossConfig->endpoint = make_shared<string>(Alibabacloud_OpenApiUtil::Client::getEndpoint(authResponse->body->endpoint, authResponse->body->useAccelerate, _endpointType));
ossClient = make_shared<Alibabacloud_OSS::Client>(ossConfig);
fileObj = make_shared<Darabonba_FileForm::FileField>(map<string, boost::any>({
{"filename", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"content", !request->maskImageUrlObject ? boost::any() : boost::any(*request->maskImageUrlObject)},
{"contentType", boost::any(string(""))}
}));
ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>(map<string, boost::any>({
{"accessKeyId", !authResponse->body->accessKeyId ? boost::any() : boost::any(*authResponse->body->accessKeyId)},
{"policy", !authResponse->body->encodedPolicy ? boost::any() : boost::any(*authResponse->body->encodedPolicy)},
{"signature", !authResponse->body->signature ? boost::any() : boost::any(*authResponse->body->signature)},
{"key", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"file", !fileObj ? boost::any() : boost::any(*fileObj)},
{"successActionStatus", boost::any(string("201"))}
}));
uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>(map<string, boost::any>({
{"bucketName", !authResponse->body->bucket ? boost::any() : boost::any(*authResponse->body->bucket)},
{"header", !ossHeader ? boost::any() : boost::any(*ossHeader)}
}));
ossClient->postObject(uploadRequest, ossRuntime);
interactiveScribbleSegmentationReq->maskImageUrl = make_shared<string>(string("http://") + string(*authResponse->body->bucket) + string(".") + string(*authResponse->body->endpoint) + string("/") + string(*authResponse->body->objectKey));
}
if (!Darabonba_Util::Client::isUnset<Darabonba::Stream>(request->negScribbleImageUrlObject)) {
authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>(authClient->authorizeFileUploadWithOptions(authRequest, runtime));
ossConfig->accessKeyId = authResponse->body->accessKeyId;
ossConfig->endpoint = make_shared<string>(Alibabacloud_OpenApiUtil::Client::getEndpoint(authResponse->body->endpoint, authResponse->body->useAccelerate, _endpointType));
ossClient = make_shared<Alibabacloud_OSS::Client>(ossConfig);
fileObj = make_shared<Darabonba_FileForm::FileField>(map<string, boost::any>({
{"filename", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"content", !request->negScribbleImageUrlObject ? boost::any() : boost::any(*request->negScribbleImageUrlObject)},
{"contentType", boost::any(string(""))}
}));
ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>(map<string, boost::any>({
{"accessKeyId", !authResponse->body->accessKeyId ? boost::any() : boost::any(*authResponse->body->accessKeyId)},
{"policy", !authResponse->body->encodedPolicy ? boost::any() : boost::any(*authResponse->body->encodedPolicy)},
{"signature", !authResponse->body->signature ? boost::any() : boost::any(*authResponse->body->signature)},
{"key", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"file", !fileObj ? boost::any() : boost::any(*fileObj)},
{"successActionStatus", boost::any(string("201"))}
}));
uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>(map<string, boost::any>({
{"bucketName", !authResponse->body->bucket ? boost::any() : boost::any(*authResponse->body->bucket)},
{"header", !ossHeader ? boost::any() : boost::any(*ossHeader)}
}));
ossClient->postObject(uploadRequest, ossRuntime);
interactiveScribbleSegmentationReq->negScribbleImageUrl = make_shared<string>(string("http://") + string(*authResponse->body->bucket) + string(".") + string(*authResponse->body->endpoint) + string("/") + string(*authResponse->body->objectKey));
}
if (!Darabonba_Util::Client::isUnset<Darabonba::Stream>(request->posScribbleImageUrlObject)) {
authResponse = make_shared<Alibabacloud_OpenPlatform20191219::AuthorizeFileUploadResponse>(authClient->authorizeFileUploadWithOptions(authRequest, runtime));
ossConfig->accessKeyId = authResponse->body->accessKeyId;
ossConfig->endpoint = make_shared<string>(Alibabacloud_OpenApiUtil::Client::getEndpoint(authResponse->body->endpoint, authResponse->body->useAccelerate, _endpointType));
ossClient = make_shared<Alibabacloud_OSS::Client>(ossConfig);
fileObj = make_shared<Darabonba_FileForm::FileField>(map<string, boost::any>({
{"filename", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"content", !request->posScribbleImageUrlObject ? boost::any() : boost::any(*request->posScribbleImageUrlObject)},
{"contentType", boost::any(string(""))}
}));
ossHeader = make_shared<Alibabacloud_OSS::PostObjectRequestHeader>(map<string, boost::any>({
{"accessKeyId", !authResponse->body->accessKeyId ? boost::any() : boost::any(*authResponse->body->accessKeyId)},
{"policy", !authResponse->body->encodedPolicy ? boost::any() : boost::any(*authResponse->body->encodedPolicy)},
{"signature", !authResponse->body->signature ? boost::any() : boost::any(*authResponse->body->signature)},
{"key", !authResponse->body->objectKey ? boost::any() : boost::any(*authResponse->body->objectKey)},
{"file", !fileObj ? boost::any() : boost::any(*fileObj)},
{"successActionStatus", boost::any(string("201"))}
}));
uploadRequest = make_shared<Alibabacloud_OSS::PostObjectRequest>(map<string, boost::any>({
{"bucketName", !authResponse->body->bucket ? boost::any() : boost::any(*authResponse->body->bucket)},
{"header", !ossHeader ? boost::any() : boost::any(*ossHeader)}
}));
ossClient->postObject(uploadRequest, ossRuntime);
interactiveScribbleSegmentationReq->posScribbleImageUrl = make_shared<string>(string("http://") + string(*authResponse->body->bucket) + string(".") + string(*authResponse->body->endpoint) + string("/") + string(*authResponse->body->objectKey));
}
shared_ptr<InteractiveScribbleSegmentationResponse> interactiveScribbleSegmentationResp = make_shared<InteractiveScribbleSegmentationResponse>(interactiveScribbleSegmentationWithOptions(interactiveScribbleSegmentationReq, runtime));
return *interactiveScribbleSegmentationResp;
}