Skip to content

Commit b2ff7b9

Browse files
committed
Update API ValidateEmail: add request parameters CheckGraylist.
1 parent 7794795 commit b2ff7b9

File tree

3 files changed

+111
-36
lines changed

3 files changed

+111
-36
lines changed

dm-20151123/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-11-20 Version: 1.7.2
2+
- Update API ValidateEmail: add request parameters CheckGraylist.
3+
4+
15
2025-10-29 Version: 1.7.1
26
- Generated php 2015-11-23 for Dm.
37

dm-20151123/src/Dm.php

Lines changed: 93 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
namespace AlibabaCloud\SDK\Dm\V20151123;
66

77
use AlibabaCloud\Dara\Dara;
8+
use AlibabaCloud\Dara\Exception\DaraException;
9+
use AlibabaCloud\Dara\Exception\DaraUnableRetryException;
810
use AlibabaCloud\Dara\Models\FileField;
911
use AlibabaCloud\Dara\Models\RuntimeOptions;
1012
use AlibabaCloud\Dara\Request;
13+
use AlibabaCloud\Dara\RetryPolicy\RetryPolicyContext;
1114
use AlibabaCloud\Dara\Util\FormUtil;
1215
use AlibabaCloud\Dara\Util\StreamUtil;
1316
use AlibabaCloud\Dara\Util\XML;
@@ -178,48 +181,98 @@ public function __construct($config)
178181
}
179182

180183
/**
181-
* @param string $bucketName
182-
* @param mixed[] $form
184+
* @param string $bucketName
185+
* @param mixed[] $form
186+
* @param RuntimeOptions $runtime
183187
*
184188
* @return mixed[]
185189
*/
186-
public function _postOSSObject($bucketName, $form)
187-
{
188-
$_request = new Request();
189-
$boundary = FormUtil::getBoundary();
190-
$_request->protocol = 'HTTPS';
191-
$_request->method = 'POST';
192-
$_request->pathname = '/';
193-
$_request->headers = [
194-
'host' => '' . @$form['host'],
195-
'date' => Utils::getDateUTCString(),
196-
'user-agent' => Utils::getUserAgent(''),
190+
public function _postOSSObject($bucketName, $form, $runtime)
191+
{
192+
$_runtime = [
193+
'key' => '' . ($runtime->key ?: $this->_key),
194+
'cert' => '' . ($runtime->cert ?: $this->_cert),
195+
'ca' => '' . ($runtime->ca ?: $this->_ca),
196+
'readTimeout' => (($runtime->readTimeout ?: $this->_readTimeout) + 0),
197+
'connectTimeout' => (($runtime->connectTimeout ?: $this->_connectTimeout) + 0),
198+
'httpProxy' => '' . ($runtime->httpProxy ?: $this->_httpProxy),
199+
'httpsProxy' => '' . ($runtime->httpsProxy ?: $this->_httpsProxy),
200+
'noProxy' => '' . ($runtime->noProxy ?: $this->_noProxy),
201+
'socks5Proxy' => '' . ($runtime->socks5Proxy ?: $this->_socks5Proxy),
202+
'socks5NetWork' => '' . ($runtime->socks5NetWork ?: $this->_socks5NetWork),
203+
'maxIdleConns' => (($runtime->maxIdleConns ?: $this->_maxIdleConns) + 0),
204+
'retryOptions' => $this->_retryOptions,
205+
'ignoreSSL' => (bool) (($runtime->ignoreSSL ?: false)),
206+
'tlsMinVersion' => $this->_tlsMinVersion,
197207
];
198-
@$_request->headers['content-type'] = 'multipart/form-data; boundary=' . $boundary . '';
199-
$_request->body = FormUtil::toFileForm($form, $boundary);
200-
$_response = Dara::send($_request);
201208

202-
$respMap = null;
203-
$bodyStr = StreamUtil::readAsString($_response->body);
204-
if (($_response->statusCode >= 400) && ($_response->statusCode < 600)) {
205-
$respMap = XML::parseXml($bodyStr, null);
206-
$err = @$respMap['Error'];
209+
$_retriesAttempted = 0;
210+
$_lastRequest = null;
211+
$_lastResponse = null;
212+
$_context = new RetryPolicyContext([
213+
'retriesAttempted' => $_retriesAttempted,
214+
]);
215+
while (Dara::shouldRetry($_runtime['retryOptions'], $_context)) {
216+
if ($_retriesAttempted > 0) {
217+
$_backoffTime = Dara::getBackoffDelay($_runtime['retryOptions'], $_context);
218+
if ($_backoffTime > 0) {
219+
Dara::sleep($_backoffTime);
220+
}
221+
}
207222

208-
throw new ClientException([
209-
'code' => '' . @$err['Code'],
210-
'message' => '' . @$err['Message'],
211-
'data' => [
212-
'httpCode' => $_response->statusCode,
213-
'requestId' => '' . @$err['RequestId'],
214-
'hostId' => '' . @$err['HostId'],
215-
],
216-
]);
217-
}
223+
++$_retriesAttempted;
224+
225+
try {
226+
$_request = new Request();
227+
$boundary = FormUtil::getBoundary();
228+
$_request->protocol = 'HTTPS';
229+
$_request->method = 'POST';
230+
$_request->pathname = '/';
231+
$_request->headers = [
232+
'host' => '' . @$form['host'],
233+
'date' => Utils::getDateUTCString(),
234+
'user-agent' => Utils::getUserAgent(''),
235+
];
236+
@$_request->headers['content-type'] = 'multipart/form-data; boundary=' . $boundary . '';
237+
$_request->body = FormUtil::toFileForm($form, $boundary);
238+
$_lastRequest = $_request;
239+
$_response = Dara::send($_request, $_runtime);
240+
$_lastResponse = $_response;
241+
242+
$respMap = null;
243+
$bodyStr = StreamUtil::readAsString($_response->body);
244+
if (($_response->statusCode >= 400) && ($_response->statusCode < 600)) {
245+
$respMap = XML::parseXml($bodyStr, null);
246+
$err = @$respMap['Error'];
247+
248+
throw new ClientException([
249+
'code' => '' . @$err['Code'],
250+
'message' => '' . @$err['Message'],
251+
'data' => [
252+
'httpCode' => $_response->statusCode,
253+
'requestId' => '' . @$err['RequestId'],
254+
'hostId' => '' . @$err['HostId'],
255+
],
256+
]);
257+
}
258+
259+
$respMap = XML::parseXml($bodyStr, null);
218260

219-
$respMap = XML::parseXml($bodyStr, null);
261+
return Dara::merge([
262+
], $respMap);
263+
} catch (DaraException $e) {
264+
$_context = new RetryPolicyContext([
265+
'retriesAttempted' => $_retriesAttempted,
266+
'lastRequest' => $_lastRequest,
267+
'lastResponse' => $_lastResponse,
268+
'exception' => $e,
269+
]);
220270

221-
return Dara::merge([
222-
], $respMap);
271+
continue;
272+
}
273+
}
274+
275+
throw new DaraUnableRetryException($_context);
223276
}
224277

225278
/**
@@ -5056,7 +5109,7 @@ public function sendValidateFileAdvance($request, $runtime)
50565109
'file' => $fileObj,
50575110
'success_action_status' => '201',
50585111
];
5059-
$this->_postOSSObject(@$authResponseBody['Bucket'], $ossHeader);
5112+
$this->_postOSSObject(@$authResponseBody['Bucket'], $ossHeader, $runtime);
50605113
$sendValidateFileReq->fileUrl = 'http://' . @$authResponseBody['Bucket'] . '.' . @$authResponseBody['Endpoint'] . '/' . @$authResponseBody['ObjectKey'] . '';
50615114
}
50625115

@@ -5564,7 +5617,7 @@ public function singleSendMailAdvance($request, $runtime)
55645617
'file' => $fileObj,
55655618
'success_action_status' => '201',
55665619
];
5567-
$this->_postOSSObject(@$authResponseBody['Bucket'], $ossHeader);
5620+
$this->_postOSSObject(@$authResponseBody['Bucket'], $ossHeader, $runtime);
55685621
$tmpObj = @$singleSendMailReq->attachments[$i0];
55695622
$tmpObj->attachmentUrl = 'http://' . @$authResponseBody['Bucket'] . '.' . @$authResponseBody['Endpoint'] . '/' . @$authResponseBody['ObjectKey'] . '';
55705623
++$i0;
@@ -5789,6 +5842,10 @@ public function validateEmailWithOptions($request, $runtime)
57895842
{
57905843
$request->validate();
57915844
$query = [];
5845+
if (null !== $request->checkGraylist) {
5846+
@$query['CheckGraylist'] = $request->checkGraylist;
5847+
}
5848+
57925849
if (null !== $request->email) {
57935850
@$query['Email'] = $request->email;
57945851
}

dm-20151123/src/Models/ValidateEmailRequest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
class ValidateEmailRequest extends Model
1010
{
11+
/**
12+
* @var bool
13+
*/
14+
public $checkGraylist;
15+
1116
/**
1217
* @var string
1318
*/
@@ -18,6 +23,7 @@ class ValidateEmailRequest extends Model
1823
*/
1924
public $timeout;
2025
protected $_name = [
26+
'checkGraylist' => 'CheckGraylist',
2127
'email' => 'Email',
2228
'timeout' => 'Timeout',
2329
];
@@ -30,6 +36,10 @@ public function validate()
3036
public function toArray($noStream = false)
3137
{
3238
$res = [];
39+
if (null !== $this->checkGraylist) {
40+
$res['CheckGraylist'] = $this->checkGraylist;
41+
}
42+
3343
if (null !== $this->email) {
3444
$res['Email'] = $this->email;
3545
}
@@ -49,6 +59,10 @@ public function toMap($noStream = false)
4959
public static function fromMap($map = [])
5060
{
5161
$model = new self();
62+
if (isset($map['CheckGraylist'])) {
63+
$model->checkGraylist = $map['CheckGraylist'];
64+
}
65+
5266
if (isset($map['Email'])) {
5367
$model->email = $map['Email'];
5468
}

0 commit comments

Comments
 (0)