Skip to content

Commit 5894d77

Browse files
committed
Support API DeepfakeDetectIntlStream.
1 parent 14643d4 commit 5894d77

File tree

7 files changed

+720
-0
lines changed

7 files changed

+720
-0
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-10-11 Version: 3.15.0
2+
- Support API DeepfakeDetectIntlStream.
3+
4+
15
2025-09-29 Version: 3.14.0
26
- Support API CredentialGetResultIntl.
37
- Support API CredentialSubmitIntl.

src/Cloudauthintl.php

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CredentialVerifyIntlResponse;
3737
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlRequest;
3838
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlResponse;
39+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlStreamAdvanceRequest;
40+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlStreamRequest;
41+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlStreamResponse;
3942
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeleteFaceGroupRequest;
4043
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeleteFaceGroupResponse;
4144
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeleteFaceRecordRequest;
@@ -1237,6 +1240,179 @@ public function deepfakeDetectIntl($request)
12371240
return $this->deepfakeDetectIntlWithOptions($request, $runtime);
12381241
}
12391242

1243+
/**
1244+
* deepfake文件流api.
1245+
*
1246+
* @param Request - DeepfakeDetectIntlStreamRequest
1247+
* @param runtime - runtime options for this request RuntimeOptions
1248+
*
1249+
* @returns DeepfakeDetectIntlStreamResponse
1250+
*
1251+
* @param DeepfakeDetectIntlStreamRequest $request
1252+
* @param RuntimeOptions $runtime
1253+
*
1254+
* @return DeepfakeDetectIntlStreamResponse
1255+
*/
1256+
public function deepfakeDetectIntlStreamWithOptions($request, $runtime)
1257+
{
1258+
$request->validate();
1259+
$body = [];
1260+
if (null !== $request->faceBase64) {
1261+
@$body['FaceBase64'] = $request->faceBase64;
1262+
}
1263+
1264+
if (null !== $request->faceFile) {
1265+
@$body['FaceFile'] = $request->faceFile;
1266+
}
1267+
1268+
if (null !== $request->faceInputType) {
1269+
@$body['FaceInputType'] = $request->faceInputType;
1270+
}
1271+
1272+
if (null !== $request->faceUrl) {
1273+
@$body['FaceUrl'] = $request->faceUrl;
1274+
}
1275+
1276+
if (null !== $request->merchantBizId) {
1277+
@$body['MerchantBizId'] = $request->merchantBizId;
1278+
}
1279+
1280+
if (null !== $request->productCode) {
1281+
@$body['ProductCode'] = $request->productCode;
1282+
}
1283+
1284+
if (null !== $request->sceneCode) {
1285+
@$body['SceneCode'] = $request->sceneCode;
1286+
}
1287+
1288+
$req = new OpenApiRequest([
1289+
'body' => Utils::parseToMap($body),
1290+
]);
1291+
$params = new Params([
1292+
'action' => 'DeepfakeDetectIntlStream',
1293+
'version' => '2022-08-09',
1294+
'protocol' => 'HTTPS',
1295+
'pathname' => '/',
1296+
'method' => 'POST',
1297+
'authType' => 'AK',
1298+
'style' => 'RPC',
1299+
'reqBodyType' => 'formData',
1300+
'bodyType' => 'json',
1301+
]);
1302+
1303+
return DeepfakeDetectIntlStreamResponse::fromMap($this->callApi($params, $req, $runtime));
1304+
}
1305+
1306+
/**
1307+
* deepfake文件流api.
1308+
*
1309+
* @param Request - DeepfakeDetectIntlStreamRequest
1310+
*
1311+
* @returns DeepfakeDetectIntlStreamResponse
1312+
*
1313+
* @param DeepfakeDetectIntlStreamRequest $request
1314+
*
1315+
* @return DeepfakeDetectIntlStreamResponse
1316+
*/
1317+
public function deepfakeDetectIntlStream($request)
1318+
{
1319+
$runtime = new RuntimeOptions([]);
1320+
1321+
return $this->deepfakeDetectIntlStreamWithOptions($request, $runtime);
1322+
}
1323+
1324+
/**
1325+
* @param DeepfakeDetectIntlStreamAdvanceRequest $request
1326+
* @param RuntimeOptions $runtime
1327+
*
1328+
* @return DeepfakeDetectIntlStreamResponse
1329+
*/
1330+
public function deepfakeDetectIntlStreamAdvance($request, $runtime)
1331+
{
1332+
// Step 0: init client
1333+
if (null === $this->_credential) {
1334+
throw new ClientException([
1335+
'code' => 'InvalidCredentials',
1336+
'message' => 'Please set up the credentials correctly. If you are setting them through environment variables, please ensure that ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET are set correctly. See https://help.aliyun.com/zh/sdk/developer-reference/configure-the-alibaba-cloud-accesskey-environment-variable-on-linux-macos-and-windows-systems for more details.',
1337+
]);
1338+
}
1339+
1340+
$credentialModel = $this->_credential->getCredential();
1341+
$accessKeyId = $credentialModel->accessKeyId;
1342+
$accessKeySecret = $credentialModel->accessKeySecret;
1343+
$securityToken = $credentialModel->securityToken;
1344+
$credentialType = $credentialModel->type;
1345+
$openPlatformEndpoint = $this->_openPlatformEndpoint;
1346+
if (null === $openPlatformEndpoint || '' == $openPlatformEndpoint) {
1347+
$openPlatformEndpoint = 'openplatform.aliyuncs.com';
1348+
}
1349+
1350+
if (null === $credentialType) {
1351+
$credentialType = 'access_key';
1352+
}
1353+
1354+
$authConfig = new Config([
1355+
'accessKeyId' => $accessKeyId,
1356+
'accessKeySecret' => $accessKeySecret,
1357+
'securityToken' => $securityToken,
1358+
'type' => $credentialType,
1359+
'endpoint' => $openPlatformEndpoint,
1360+
'protocol' => $this->_protocol,
1361+
'regionId' => $this->_regionId,
1362+
]);
1363+
$authClient = new OpenApiClient($authConfig);
1364+
$authRequest = [
1365+
'Product' => 'Cloudauth-intl',
1366+
'RegionId' => $this->_regionId,
1367+
];
1368+
$authReq = new OpenApiRequest([
1369+
'query' => Utils::query($authRequest),
1370+
]);
1371+
$authParams = new Params([
1372+
'action' => 'AuthorizeFileUpload',
1373+
'version' => '2019-12-19',
1374+
'protocol' => 'HTTPS',
1375+
'pathname' => '/',
1376+
'method' => 'GET',
1377+
'authType' => 'AK',
1378+
'style' => 'RPC',
1379+
'reqBodyType' => 'formData',
1380+
'bodyType' => 'json',
1381+
]);
1382+
$authResponse = [];
1383+
$fileObj = new FileField([]);
1384+
$ossHeader = [];
1385+
$tmpBody = [];
1386+
$useAccelerate = false;
1387+
$authResponseBody = [];
1388+
$deepfakeDetectIntlStreamReq = new DeepfakeDetectIntlStreamRequest([]);
1389+
Utils::convert($request, $deepfakeDetectIntlStreamReq);
1390+
if (null !== $request->faceFileObject) {
1391+
$authResponse = $authClient->callApi($authParams, $authReq, $runtime);
1392+
$tmpBody = @$authResponse['body'];
1393+
$useAccelerate = (bool) (@$tmpBody['UseAccelerate']);
1394+
$authResponseBody = Utils::stringifyMapValue($tmpBody);
1395+
$fileObj = new FileField([
1396+
'filename' => @$authResponseBody['ObjectKey'],
1397+
'content' => $request->faceFileObject,
1398+
'contentType' => '',
1399+
]);
1400+
$ossHeader = [
1401+
'host' => '' . @$authResponseBody['Bucket'] . '.' . Utils::getEndpoint(@$authResponseBody['Endpoint'], $useAccelerate, $this->_endpointType) . '',
1402+
'OSSAccessKeyId' => @$authResponseBody['AccessKeyId'],
1403+
'policy' => @$authResponseBody['EncodedPolicy'],
1404+
'Signature' => @$authResponseBody['Signature'],
1405+
'key' => @$authResponseBody['ObjectKey'],
1406+
'file' => $fileObj,
1407+
'success_action_status' => '201',
1408+
];
1409+
$this->_postOSSObject(@$authResponseBody['Bucket'], $ossHeader);
1410+
$deepfakeDetectIntlStreamReq->faceFile = 'http://' . @$authResponseBody['Bucket'] . '.' . @$authResponseBody['Endpoint'] . '/' . @$authResponseBody['ObjectKey'] . '';
1411+
}
1412+
1413+
return $this->deepfakeDetectIntlStreamWithOptions($deepfakeDetectIntlStreamReq, $runtime);
1414+
}
1415+
12401416
/**
12411417
* Delete Face Group.
12421418
*
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?php
2+
3+
// This file is auto-generated, don't edit it. Thanks.
4+
5+
namespace AlibabaCloud\SDK\Cloudauthintl\V20220809\Models;
6+
7+
use AlibabaCloud\Dara\Model;
8+
use GuzzleHttp\Psr7\Stream;
9+
10+
class DeepfakeDetectIntlStreamAdvanceRequest extends Model
11+
{
12+
/**
13+
* @var string
14+
*/
15+
public $faceBase64;
16+
17+
/**
18+
* @var Stream
19+
*/
20+
public $faceFileObject;
21+
22+
/**
23+
* @var string
24+
*/
25+
public $faceInputType;
26+
27+
/**
28+
* @var string
29+
*/
30+
public $faceUrl;
31+
32+
/**
33+
* @var string
34+
*/
35+
public $merchantBizId;
36+
37+
/**
38+
* @var string
39+
*/
40+
public $productCode;
41+
42+
/**
43+
* @var string
44+
*/
45+
public $sceneCode;
46+
protected $_name = [
47+
'faceBase64' => 'FaceBase64',
48+
'faceFileObject' => 'FaceFile',
49+
'faceInputType' => 'FaceInputType',
50+
'faceUrl' => 'FaceUrl',
51+
'merchantBizId' => 'MerchantBizId',
52+
'productCode' => 'ProductCode',
53+
'sceneCode' => 'SceneCode',
54+
];
55+
56+
public function validate()
57+
{
58+
parent::validate();
59+
}
60+
61+
public function toArray($noStream = false)
62+
{
63+
$res = [];
64+
if (null !== $this->faceBase64) {
65+
$res['FaceBase64'] = $this->faceBase64;
66+
}
67+
68+
if (null !== $this->faceFileObject) {
69+
$res['FaceFile'] = $this->faceFileObject;
70+
}
71+
72+
if (null !== $this->faceInputType) {
73+
$res['FaceInputType'] = $this->faceInputType;
74+
}
75+
76+
if (null !== $this->faceUrl) {
77+
$res['FaceUrl'] = $this->faceUrl;
78+
}
79+
80+
if (null !== $this->merchantBizId) {
81+
$res['MerchantBizId'] = $this->merchantBizId;
82+
}
83+
84+
if (null !== $this->productCode) {
85+
$res['ProductCode'] = $this->productCode;
86+
}
87+
88+
if (null !== $this->sceneCode) {
89+
$res['SceneCode'] = $this->sceneCode;
90+
}
91+
92+
return $res;
93+
}
94+
95+
public function toMap($noStream = false)
96+
{
97+
return $this->toArray($noStream);
98+
}
99+
100+
public static function fromMap($map = [])
101+
{
102+
$model = new self();
103+
if (isset($map['FaceBase64'])) {
104+
$model->faceBase64 = $map['FaceBase64'];
105+
}
106+
107+
if (isset($map['FaceFile'])) {
108+
$model->faceFileObject = $map['FaceFile'];
109+
}
110+
111+
if (isset($map['FaceInputType'])) {
112+
$model->faceInputType = $map['FaceInputType'];
113+
}
114+
115+
if (isset($map['FaceUrl'])) {
116+
$model->faceUrl = $map['FaceUrl'];
117+
}
118+
119+
if (isset($map['MerchantBizId'])) {
120+
$model->merchantBizId = $map['MerchantBizId'];
121+
}
122+
123+
if (isset($map['ProductCode'])) {
124+
$model->productCode = $map['ProductCode'];
125+
}
126+
127+
if (isset($map['SceneCode'])) {
128+
$model->sceneCode = $map['SceneCode'];
129+
}
130+
131+
return $model;
132+
}
133+
}

0 commit comments

Comments
 (0)