@alicloud/dm20151123 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/client.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  // This file is auto-generated, don't edit it
2
2
  import * as $dara from '@darabonba/typescript';
3
+ import OSS, * as $OSS from '@alicloud/oss-client';
4
+ import OpenPlatform, * as $OpenPlatform from '@alicloud/openplatform20191219';
5
+ import * as $OSSUtil from '@alicloud/oss-util';
6
+ import * as $FileForm from '@alicloud/tea-fileform';
3
7
  import OpenApi from '@alicloud/openapi-core';
4
8
  import { OpenApiUtil, $OpenApiUtil }from '@alicloud/openapi-core';
5
9
 
@@ -2679,6 +2683,10 @@ export default class Client extends OpenApi {
2679
2683
  query["AddressType"] = request.addressType;
2680
2684
  }
2681
2685
 
2686
+ if (!$dara.isNull(request.attachments)) {
2687
+ query["Attachments"] = request.attachments;
2688
+ }
2689
+
2682
2690
  if (!$dara.isNull(request.clickTrace)) {
2683
2691
  query["ClickTrace"] = request.clickTrace;
2684
2692
  }
@@ -2775,6 +2783,90 @@ export default class Client extends OpenApi {
2775
2783
  return await this.singleSendMailWithOptions(request, runtime);
2776
2784
  }
2777
2785
 
2786
+ async singleSendMailAdvance(request: $_model.SingleSendMailAdvanceRequest, runtime: $dara.RuntimeOptions): Promise<$_model.SingleSendMailResponse> {
2787
+ // Step 0: init client
2788
+ let accessKeyId = await this._credential.getAccessKeyId();
2789
+ let accessKeySecret = await this._credential.getAccessKeySecret();
2790
+ let securityToken = await this._credential.getSecurityToken();
2791
+ let credentialType = this._credential.getType();
2792
+ let openPlatformEndpoint = this._openPlatformEndpoint;
2793
+ if ($dara.isNull(openPlatformEndpoint)) {
2794
+ openPlatformEndpoint = "openplatform.aliyuncs.com";
2795
+ }
2796
+
2797
+ if ($dara.isNull(credentialType)) {
2798
+ credentialType = "access_key";
2799
+ }
2800
+
2801
+ let authConfig = new $OpenApiUtil.Config({
2802
+ accessKeyId: accessKeyId,
2803
+ accessKeySecret: accessKeySecret,
2804
+ securityToken: securityToken,
2805
+ type: credentialType,
2806
+ endpoint: openPlatformEndpoint,
2807
+ protocol: this._protocol,
2808
+ regionId: this._regionId,
2809
+ });
2810
+ let authClient = new OpenPlatform(authConfig);
2811
+ let authRequest = new $OpenPlatform.AuthorizeFileUploadRequest({
2812
+ product: "Dm",
2813
+ regionId: this._regionId,
2814
+ });
2815
+ let authResponse = new $OpenPlatform.AuthorizeFileUploadResponse({ });
2816
+ let ossConfig = new $OSS.Config({
2817
+ accessKeyId: accessKeyId,
2818
+ accessKeySecret: accessKeySecret,
2819
+ type: "access_key",
2820
+ protocol: this._protocol,
2821
+ regionId: this._regionId,
2822
+ });
2823
+ let ossClient : OSS = new OSS(ossConfig);
2824
+ let fileObj = new $FileForm.FileField({ });
2825
+ let ossHeader = new $OSS.PostObjectRequestHeader({ });
2826
+ let uploadRequest = new $OSS.PostObjectRequest({ });
2827
+ let ossRuntime = new $OSSUtil.RuntimeOptions({ });
2828
+ OpenApiUtil.convert(runtime, ossRuntime);
2829
+ let singleSendMailReq = new $_model.SingleSendMailRequest({ });
2830
+ OpenApiUtil.convert(request, singleSendMailReq);
2831
+ if (!$dara.isNull(request.attachments)) {
2832
+ let i0 : number = 0;
2833
+
2834
+ for(let item0 of request.attachments) {
2835
+ if (!$dara.isNull(item0.attachmentUrlObject)) {
2836
+ authResponse = await authClient.authorizeFileUploadWithOptions(authRequest, runtime);
2837
+ ossConfig.accessKeyId = authResponse.body.accessKeyId;
2838
+ ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, this._endpointType);
2839
+ ossClient = new OSS(ossConfig);
2840
+ fileObj = new $FileForm.FileField({
2841
+ filename: authResponse.body.objectKey,
2842
+ content: item0.attachmentUrlObject,
2843
+ contentType: "",
2844
+ });
2845
+ ossHeader = new $OSS.PostObjectRequestHeader({
2846
+ accessKeyId: authResponse.body.accessKeyId,
2847
+ policy: authResponse.body.encodedPolicy,
2848
+ signature: authResponse.body.signature,
2849
+ key: authResponse.body.objectKey,
2850
+ file: fileObj,
2851
+ successActionStatus: "201",
2852
+ });
2853
+ uploadRequest = new $OSS.PostObjectRequest({
2854
+ bucketName: authResponse.body.bucket,
2855
+ header: ossHeader,
2856
+ });
2857
+ await ossClient.postObject(uploadRequest, ossRuntime);
2858
+ let tmp : $_model.SingleSendMailRequestAttachments = singleSendMailReq.attachments[i0];
2859
+ tmp.attachmentUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
2860
+ i0++;
2861
+ }
2862
+
2863
+ }
2864
+ }
2865
+
2866
+ let singleSendMailResp = await this.singleSendMailWithOptions(singleSendMailReq, runtime);
2867
+ return singleSendMailResp;
2868
+ }
2869
+
2778
2870
  /**
2779
2871
  * Update IP Protection API
2780
2872
  *
@@ -0,0 +1,238 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+ import { SingleSendMailAdvanceRequestAttachments } from "./SingleSendMailAdvanceRequestAttachments";
4
+
5
+
6
+ export class SingleSendMailAdvanceRequest extends $dara.Model {
7
+ /**
8
+ * @remarks
9
+ * The sending address configured in the management console.
10
+ *
11
+ * This parameter is required.
12
+ *
13
+ * @example
14
+ * test***@example.net
15
+ */
16
+ accountName?: string;
17
+ /**
18
+ * @remarks
19
+ * Address type. Values:
20
+ *
21
+ * 0: Random account
22
+ *
23
+ * 1: Sending address
24
+ *
25
+ * This parameter is required.
26
+ *
27
+ * @example
28
+ * 1
29
+ */
30
+ addressType?: number;
31
+ attachments?: SingleSendMailAdvanceRequestAttachments[];
32
+ /**
33
+ * @remarks
34
+ * 1: Enable data tracking function
35
+ *
36
+ * 0 (default): Disable data tracking function.
37
+ *
38
+ * @example
39
+ * 0
40
+ */
41
+ clickTrace?: string;
42
+ /**
43
+ * @remarks
44
+ * Sender nickname, with a maximum length of 15 characters.
45
+ *
46
+ * For example, if the sender\\"s nickname is set to "Xiaohong" and the sending address is test***@example.net, the recipient will see the sending address as "Xiaohong" <test***@example.net>.
47
+ *
48
+ * @example
49
+ * Xiaohong
50
+ */
51
+ fromAlias?: string;
52
+ /**
53
+ * @remarks
54
+ * Standard fields that can currently be added to the email header include Message-ID, List-Unsubscribe, and List-Unsubscribe-Post. Standard fields will overwrite existing values in the email header, while non-standard fields need to start with X-User- and will be appended to the email header.
55
+ * Currently, up to 10 headers can be passed in JSON format, and both standard and non-standard fields must comply with the syntax requirements for headers.
56
+ *
57
+ * @example
58
+ * {
59
+ * "Message-ID": "<msg0001@example.com>",
60
+ * "X-User-UID1": "UID-1-000001",
61
+ * "X-User-UID2": "UID-2-000001"
62
+ * }
63
+ */
64
+ headers?: string;
65
+ /**
66
+ * @remarks
67
+ * Email HTML body, limited to 80K by the SDK. Note: HtmlBody and TextBody are for different types of email content, and one of them must be provided.
68
+ *
69
+ * @example
70
+ * body
71
+ */
72
+ htmlBody?: string;
73
+ ipPoolId?: string;
74
+ ownerId?: number;
75
+ /**
76
+ * @remarks
77
+ * Reply-to address
78
+ *
79
+ * @example
80
+ * test2***@example.net
81
+ */
82
+ replyAddress?: string;
83
+ /**
84
+ * @remarks
85
+ * Reply-to address nickname
86
+ *
87
+ * @example
88
+ * Xiaohong
89
+ */
90
+ replyAddressAlias?: string;
91
+ /**
92
+ * @remarks
93
+ * Whether to enable the reply-to address configured in the management console (the status must be verified). The value range is the string `true` or `false` (not a boolean value).
94
+ *
95
+ * This parameter is required.
96
+ *
97
+ * @example
98
+ * true
99
+ */
100
+ replyToAddress?: boolean;
101
+ resourceOwnerAccount?: string;
102
+ resourceOwnerId?: number;
103
+ /**
104
+ * @remarks
105
+ * Email subject, with a maximum length of 100 characters.
106
+ *
107
+ * This parameter is required.
108
+ *
109
+ * @example
110
+ * Subject
111
+ */
112
+ subject?: string;
113
+ /**
114
+ * @remarks
115
+ * A tag created in the email push console, used to categorize batches of emails sent. You can use tags to query the sending status of each batch. Additionally, if the email tracking feature is enabled, you must use an email tag when sending emails.
116
+ *
117
+ * @example
118
+ * test
119
+ */
120
+ tagName?: string;
121
+ /**
122
+ * @remarks
123
+ * Email text body, limited to 80K by the SDK. Note: HtmlBody and TextBody are for different types of email content, and one of them must be provided.
124
+ *
125
+ * @example
126
+ * body
127
+ */
128
+ textBody?: string;
129
+ /**
130
+ * @remarks
131
+ * Recipient addresses. Multiple email addresses can be separated by commas, with a maximum of 100 addresses (supports mailing lists).
132
+ *
133
+ * This parameter is required.
134
+ *
135
+ * @example
136
+ * test1***@example.net
137
+ */
138
+ toAddress?: string;
139
+ /**
140
+ * @remarks
141
+ * Filtering level. Refer to the [Unsubscribe Function Link Generation and Filtering Mechanism](https://help.aliyun.com/document_detail/2689048.html) document.
142
+ *
143
+ * disabled: No filtering
144
+ *
145
+ * default: Use the default strategy, bulk addresses use the sending address level filtering
146
+ *
147
+ * mailfrom: Sending address level filtering
148
+ *
149
+ * mailfrom_domain: Sending domain level filtering
150
+ *
151
+ * edm_id: Account level filtering
152
+ *
153
+ * @example
154
+ * mailfrom_domain
155
+ */
156
+ unSubscribeFilterLevel?: string;
157
+ /**
158
+ * @remarks
159
+ * Type of the generated unsubscribe link. Refer to the [Unsubscribe Function Link Generation and Filtering Mechanism](https://help.aliyun.com/document_detail/2689048.html) document.
160
+ *
161
+ * disabled: Do not generate
162
+ *
163
+ * default: Use the default strategy: Generate unsubscribe links for bulk-type sending addresses when sending to specific domains, such as those containing keywords like "gmail", "yahoo",
164
+ *
165
+ * "google", "aol.com", "hotmail",
166
+ *
167
+ * "outlook", "ymail.com", etc.
168
+ *
169
+ * zh-cn: Generate, for future content preparation
170
+ *
171
+ * en-us: Generate, for future content preparation
172
+ *
173
+ * @example
174
+ * default
175
+ */
176
+ unSubscribeLinkType?: string;
177
+ static names(): { [key: string]: string } {
178
+ return {
179
+ accountName: 'AccountName',
180
+ addressType: 'AddressType',
181
+ attachments: 'Attachments',
182
+ clickTrace: 'ClickTrace',
183
+ fromAlias: 'FromAlias',
184
+ headers: 'Headers',
185
+ htmlBody: 'HtmlBody',
186
+ ipPoolId: 'IpPoolId',
187
+ ownerId: 'OwnerId',
188
+ replyAddress: 'ReplyAddress',
189
+ replyAddressAlias: 'ReplyAddressAlias',
190
+ replyToAddress: 'ReplyToAddress',
191
+ resourceOwnerAccount: 'ResourceOwnerAccount',
192
+ resourceOwnerId: 'ResourceOwnerId',
193
+ subject: 'Subject',
194
+ tagName: 'TagName',
195
+ textBody: 'TextBody',
196
+ toAddress: 'ToAddress',
197
+ unSubscribeFilterLevel: 'UnSubscribeFilterLevel',
198
+ unSubscribeLinkType: 'UnSubscribeLinkType',
199
+ };
200
+ }
201
+
202
+ static types(): { [key: string]: any } {
203
+ return {
204
+ accountName: 'string',
205
+ addressType: 'number',
206
+ attachments: { 'type': 'array', 'itemType': SingleSendMailAdvanceRequestAttachments },
207
+ clickTrace: 'string',
208
+ fromAlias: 'string',
209
+ headers: 'string',
210
+ htmlBody: 'string',
211
+ ipPoolId: 'string',
212
+ ownerId: 'number',
213
+ replyAddress: 'string',
214
+ replyAddressAlias: 'string',
215
+ replyToAddress: 'boolean',
216
+ resourceOwnerAccount: 'string',
217
+ resourceOwnerId: 'number',
218
+ subject: 'string',
219
+ tagName: 'string',
220
+ textBody: 'string',
221
+ toAddress: 'string',
222
+ unSubscribeFilterLevel: 'string',
223
+ unSubscribeLinkType: 'string',
224
+ };
225
+ }
226
+
227
+ validate() {
228
+ if(Array.isArray(this.attachments)) {
229
+ $dara.Model.validateArray(this.attachments);
230
+ }
231
+ super.validate();
232
+ }
233
+
234
+ constructor(map?: { [key: string]: any }) {
235
+ super(map);
236
+ }
237
+ }
238
+
@@ -0,0 +1,31 @@
1
+ // This file is auto-generated, don't edit it
2
+ import { Readable } from 'stream';
3
+ import * as $dara from '@darabonba/typescript';
4
+
5
+
6
+ export class SingleSendMailAdvanceRequestAttachments extends $dara.Model {
7
+ attachmentName?: string;
8
+ attachmentUrlObject?: Readable;
9
+ static names(): { [key: string]: string } {
10
+ return {
11
+ attachmentName: 'AttachmentName',
12
+ attachmentUrlObject: 'AttachmentUrl',
13
+ };
14
+ }
15
+
16
+ static types(): { [key: string]: any } {
17
+ return {
18
+ attachmentName: 'string',
19
+ attachmentUrlObject: 'Readable',
20
+ };
21
+ }
22
+
23
+ validate() {
24
+ super.validate();
25
+ }
26
+
27
+ constructor(map?: { [key: string]: any }) {
28
+ super(map);
29
+ }
30
+ }
31
+
@@ -1,5 +1,6 @@
1
1
  // This file is auto-generated, don't edit it
2
2
  import * as $dara from '@darabonba/typescript';
3
+ import { SingleSendMailRequestAttachments } from "./SingleSendMailRequestAttachments";
3
4
 
4
5
 
5
6
  export class SingleSendMailRequest extends $dara.Model {
@@ -27,6 +28,7 @@ export class SingleSendMailRequest extends $dara.Model {
27
28
  * 1
28
29
  */
29
30
  addressType?: number;
31
+ attachments?: SingleSendMailRequestAttachments[];
30
32
  /**
31
33
  * @remarks
32
34
  * 1: Enable data tracking function
@@ -176,6 +178,7 @@ export class SingleSendMailRequest extends $dara.Model {
176
178
  return {
177
179
  accountName: 'AccountName',
178
180
  addressType: 'AddressType',
181
+ attachments: 'Attachments',
179
182
  clickTrace: 'ClickTrace',
180
183
  fromAlias: 'FromAlias',
181
184
  headers: 'Headers',
@@ -200,6 +203,7 @@ export class SingleSendMailRequest extends $dara.Model {
200
203
  return {
201
204
  accountName: 'string',
202
205
  addressType: 'number',
206
+ attachments: { 'type': 'array', 'itemType': SingleSendMailRequestAttachments },
203
207
  clickTrace: 'string',
204
208
  fromAlias: 'string',
205
209
  headers: 'string',
@@ -221,6 +225,9 @@ export class SingleSendMailRequest extends $dara.Model {
221
225
  }
222
226
 
223
227
  validate() {
228
+ if(Array.isArray(this.attachments)) {
229
+ $dara.Model.validateArray(this.attachments);
230
+ }
224
231
  super.validate();
225
232
  }
226
233
 
@@ -0,0 +1,30 @@
1
+ // This file is auto-generated, don't edit it
2
+ import * as $dara from '@darabonba/typescript';
3
+
4
+
5
+ export class SingleSendMailRequestAttachments extends $dara.Model {
6
+ attachmentName?: string;
7
+ attachmentUrl?: string;
8
+ static names(): { [key: string]: string } {
9
+ return {
10
+ attachmentName: 'AttachmentName',
11
+ attachmentUrl: 'AttachmentUrl',
12
+ };
13
+ }
14
+
15
+ static types(): { [key: string]: any } {
16
+ return {
17
+ attachmentName: 'string',
18
+ attachmentUrl: 'string',
19
+ };
20
+ }
21
+
22
+ validate() {
23
+ super.validate();
24
+ }
25
+
26
+ constructor(map?: { [key: string]: any }) {
27
+ super(map);
28
+ }
29
+ }
30
+
@@ -27,6 +27,8 @@ export { SenderStatisticsByTagNameAndBatchIDResponseBodyDataStat } from './Sende
27
27
  export { SenderStatisticsByTagNameAndBatchIDResponseBodyData } from './SenderStatisticsByTagNameAndBatchIdresponseBodyData';
28
28
  export { SenderStatisticsDetailByParamResponseBodyDataMailDetail } from './SenderStatisticsDetailByParamResponseBodyDataMailDetail';
29
29
  export { SenderStatisticsDetailByParamResponseBodyData } from './SenderStatisticsDetailByParamResponseBodyData';
30
+ export { SingleSendMailRequestAttachments } from './SingleSendMailRequestAttachments';
31
+ export { SingleSendMailAdvanceRequestAttachments } from './SingleSendMailAdvanceRequestAttachments';
30
32
  export { UpdateUserRequestUser } from './UpdateUserRequestUser';
31
33
  export { AddIpfilterRequest } from './AddIpfilterRequest';
32
34
  export { AddIpfilterResponseBody } from './AddIpfilterResponseBody';
@@ -154,6 +156,7 @@ export { SetSuppressionListLevelRequest } from './SetSuppressionListLevelRequest
154
156
  export { SetSuppressionListLevelResponseBody } from './SetSuppressionListLevelResponseBody';
155
157
  export { SetSuppressionListLevelResponse } from './SetSuppressionListLevelResponse';
156
158
  export { SingleSendMailRequest } from './SingleSendMailRequest';
159
+ export { SingleSendMailAdvanceRequest } from './SingleSendMailAdvanceRequest';
157
160
  export { SingleSendMailResponseBody } from './SingleSendMailResponseBody';
158
161
  export { SingleSendMailResponse } from './SingleSendMailResponse';
159
162
  export { UpdateIpProtectionRequest } from './UpdateIpProtectionRequest';