@@ -16,41 +16,87 @@ export default class Client extends OpenApi {
1616 this . _endpoint = this . getEndpoint ( "dm" , this . _regionId , this . _endpointRule , this . _network , this . _suffix , this . _endpointMap , this . _endpoint ) ;
1717 }
1818
19- async _postOSSObject ( bucketName : string , form : { [ key : string ] : any } ) : Promise < { [ key : string ] : any } > {
20- let request_ = new $dara . Request ( ) ;
21- let boundary = $dara . Form . getBoundary ( ) ;
22- request_ . protocol = "HTTPS" ;
23- request_ . method = "POST" ;
24- request_ . pathname = `/` ;
25- request_ . headers = {
26- host : String ( form [ "host" ] ) ,
27- date : OpenApiUtil . getDateUTCString ( ) ,
28- 'user-agent' : OpenApiUtil . getUserAgent ( "" ) ,
29- } ;
30- request_ . headers [ "content-type" ] = `multipart/form-data; boundary=${ boundary } ` ;
31- request_ . body = $dara . Form . toFileForm ( form , boundary ) ;
32- let response_ = await $dara . doAction ( request_ ) ;
33-
34- let respMap : { [ key : string ] : any } = null ;
35- let bodyStr = await $dara . Stream . readAsString ( response_ . body ) ;
36- if ( ( response_ . statusCode >= 400 ) && ( response_ . statusCode < 600 ) ) {
37- respMap = $dara . XML . parseXml ( bodyStr , null ) ;
38- let err = respMap [ "Error" ] ;
39- throw new $OpenApi . ClientError ( {
40- code : String ( err [ "Code" ] ) ,
41- message : String ( err [ "Message" ] ) ,
42- data : {
43- httpCode : response_ . statusCode ,
44- requestId : String ( err [ "RequestId" ] ) ,
45- hostId : String ( err [ "HostId" ] ) ,
46- } ,
47- } ) ;
19+ async _postOSSObject ( bucketName : string , form : { [ key : string ] : any } , runtime : $dara . RuntimeOptions ) : Promise < { [ key : string ] : any } > {
20+ let _runtime : { [ key : string ] : any } = {
21+ key : runtime . key || this . _key ,
22+ cert : runtime . cert || this . _cert ,
23+ ca : runtime . ca || this . _ca ,
24+ readTimeout : runtime . readTimeout || this . _readTimeout ,
25+ connectTimeout : runtime . connectTimeout || this . _connectTimeout ,
26+ httpProxy : runtime . httpProxy || this . _httpProxy ,
27+ httpsProxy : runtime . httpsProxy || this . _httpsProxy ,
28+ noProxy : runtime . noProxy || this . _noProxy ,
29+ socks5Proxy : runtime . socks5Proxy || this . _socks5Proxy ,
30+ socks5NetWork : runtime . socks5NetWork || this . _socks5NetWork ,
31+ maxIdleConns : runtime . maxIdleConns || this . _maxIdleConns ,
32+ retryOptions : this . _retryOptions ,
33+ ignoreSSL : runtime . ignoreSSL || false ,
34+ tlsMinVersion : this . _tlsMinVersion ,
35+ }
36+
37+ let _retriesAttempted = 0 ;
38+ let _lastRequest = null , _lastResponse = null ;
39+ let _context = new $dara . RetryPolicyContext ( {
40+ retriesAttempted : _retriesAttempted ,
41+ } ) ;
42+ while ( $dara . shouldRetry ( _runtime [ 'retryOptions' ] , _context ) ) {
43+ if ( _retriesAttempted > 0 ) {
44+ let _backoffTime = $dara . getBackoffDelay ( _runtime [ 'retryOptions' ] , _context ) ;
45+ if ( _backoffTime > 0 ) {
46+ await $dara . sleep ( _backoffTime ) ;
47+ }
48+ }
49+
50+ _retriesAttempted = _retriesAttempted + 1 ;
51+ try {
52+ let request_ = new $dara . Request ( ) ;
53+ let boundary = $dara . Form . getBoundary ( ) ;
54+ request_ . protocol = "HTTPS" ;
55+ request_ . method = "POST" ;
56+ request_ . pathname = `/` ;
57+ request_ . headers = {
58+ host : String ( form [ "host" ] ) ,
59+ date : OpenApiUtil . getDateUTCString ( ) ,
60+ 'user-agent' : OpenApiUtil . getUserAgent ( "" ) ,
61+ } ;
62+ request_ . headers [ "content-type" ] = `multipart/form-data; boundary=${ boundary } ` ;
63+ request_ . body = $dara . Form . toFileForm ( form , boundary ) ;
64+ _lastRequest = request_ ;
65+ let response_ = await $dara . doAction ( request_ , _runtime ) ;
66+ _lastResponse = response_ ;
67+
68+ let respMap : { [ key : string ] : any } = null ;
69+ let bodyStr = await $dara . Stream . readAsString ( response_ . body ) ;
70+ if ( ( response_ . statusCode >= 400 ) && ( response_ . statusCode < 600 ) ) {
71+ respMap = $dara . XML . parseXml ( bodyStr , null ) ;
72+ let err = respMap [ "Error" ] ;
73+ throw new $OpenApi . ClientError ( {
74+ code : String ( err [ "Code" ] ) ,
75+ message : String ( err [ "Message" ] ) ,
76+ data : {
77+ httpCode : response_ . statusCode ,
78+ requestId : String ( err [ "RequestId" ] ) ,
79+ hostId : String ( err [ "HostId" ] ) ,
80+ } ,
81+ } ) ;
82+ }
83+
84+ respMap = $dara . XML . parseXml ( bodyStr , null ) ;
85+ return {
86+ ...respMap ,
87+ } ;
88+ } catch ( ex ) {
89+ _context = new $dara . RetryPolicyContext ( {
90+ retriesAttempted : _retriesAttempted ,
91+ httpRequest : _lastRequest ,
92+ httpResponse : _lastResponse ,
93+ exception : ex ,
94+ } ) ;
95+ continue ;
96+ }
4897 }
4998
50- respMap = $dara . XML . parseXml ( bodyStr , null ) ;
51- return {
52- ...respMap ,
53- } ;
99+ throw $dara . newUnretryableError ( _context ) ;
54100 }
55101
56102 getEndpoint ( productId : string , regionId : string , endpointRule : string , network : string , suffix : string , endpointMap : { [ key : string ] : string } , endpoint : string ) : string {
@@ -3887,7 +3933,7 @@ export default class Client extends OpenApi {
38873933 file : fileObj ,
38883934 success_action_status : "201" ,
38893935 } ;
3890- await this . _postOSSObject ( authResponseBody [ "Bucket" ] , ossHeader ) ;
3936+ await this . _postOSSObject ( authResponseBody [ "Bucket" ] , ossHeader , runtime ) ;
38913937 sendValidateFileReq . fileUrl = `http://${ authResponseBody [ "Bucket" ] } .${ authResponseBody [ "Endpoint" ] } /${ authResponseBody [ "ObjectKey" ] } ` ;
38923938 }
38933939
@@ -4329,7 +4375,7 @@ export default class Client extends OpenApi {
43294375 file : fileObj ,
43304376 success_action_status : "201" ,
43314377 } ;
4332- await this . _postOSSObject ( authResponseBody [ "Bucket" ] , ossHeader ) ;
4378+ await this . _postOSSObject ( authResponseBody [ "Bucket" ] , ossHeader , runtime ) ;
43334379 let tmpObj : $_model . SingleSendMailRequestAttachments = singleSendMailReq . attachments [ i0 ] ;
43344380 tmpObj . attachmentUrl = `http://${ authResponseBody [ "Bucket" ] } .${ authResponseBody [ "Endpoint" ] } /${ authResponseBody [ "ObjectKey" ] } ` ;
43354381 i0 ++ ;
@@ -4504,6 +4550,10 @@ export default class Client extends OpenApi {
45044550 async validateEmailWithOptions ( request : $_model . ValidateEmailRequest , runtime : $dara . RuntimeOptions ) : Promise < $_model . ValidateEmailResponse > {
45054551 request . validate ( ) ;
45064552 let query = { } ;
4553+ if ( ! $dara . isNull ( request . checkGraylist ) ) {
4554+ query [ "CheckGraylist" ] = request . checkGraylist ;
4555+ }
4556+
45074557 if ( ! $dara . isNull ( request . email ) ) {
45084558 query [ "Email" ] = request . email ;
45094559 }
0 commit comments