@alicloud/cams20200606 1.0.4

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 ADDED
@@ -0,0 +1,988 @@
1
+ // This file is auto-generated, don't edit it
2
+ /**
3
+ *
4
+ */
5
+ import Util, * as $Util from '@alicloud/tea-util';
6
+ import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
7
+ import OpenApiUtil from '@alicloud/openapi-util';
8
+ import EndpointUtil from '@alicloud/endpoint-util';
9
+ import * as $tea from '@alicloud/tea-typescript';
10
+
11
+ export class CheckContactsRequest extends $tea.Model {
12
+ channelType?: string;
13
+ contacts?: string;
14
+ from?: string;
15
+ ownerId?: number;
16
+ resourceOwnerAccount?: string;
17
+ resourceOwnerId?: number;
18
+ static names(): { [key: string]: string } {
19
+ return {
20
+ channelType: 'ChannelType',
21
+ contacts: 'Contacts',
22
+ from: 'From',
23
+ ownerId: 'OwnerId',
24
+ resourceOwnerAccount: 'ResourceOwnerAccount',
25
+ resourceOwnerId: 'ResourceOwnerId',
26
+ };
27
+ }
28
+
29
+ static types(): { [key: string]: any } {
30
+ return {
31
+ channelType: 'string',
32
+ contacts: 'string',
33
+ from: 'string',
34
+ ownerId: 'number',
35
+ resourceOwnerAccount: 'string',
36
+ resourceOwnerId: 'number',
37
+ };
38
+ }
39
+
40
+ constructor(map?: { [key: string]: any }) {
41
+ super(map);
42
+ }
43
+ }
44
+
45
+ export class CheckContactsResponseBody extends $tea.Model {
46
+ contacts?: CheckContactsResponseBodyContacts[];
47
+ requestId?: string;
48
+ resultCode?: string;
49
+ resultMessage?: string;
50
+ static names(): { [key: string]: string } {
51
+ return {
52
+ contacts: 'Contacts',
53
+ requestId: 'RequestId',
54
+ resultCode: 'ResultCode',
55
+ resultMessage: 'ResultMessage',
56
+ };
57
+ }
58
+
59
+ static types(): { [key: string]: any } {
60
+ return {
61
+ contacts: { 'type': 'array', 'itemType': CheckContactsResponseBodyContacts },
62
+ requestId: 'string',
63
+ resultCode: 'string',
64
+ resultMessage: 'string',
65
+ };
66
+ }
67
+
68
+ constructor(map?: { [key: string]: any }) {
69
+ super(map);
70
+ }
71
+ }
72
+
73
+ export class CheckContactsResponse extends $tea.Model {
74
+ headers: { [key: string]: string };
75
+ body: CheckContactsResponseBody;
76
+ static names(): { [key: string]: string } {
77
+ return {
78
+ headers: 'headers',
79
+ body: 'body',
80
+ };
81
+ }
82
+
83
+ static types(): { [key: string]: any } {
84
+ return {
85
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
86
+ body: CheckContactsResponseBody,
87
+ };
88
+ }
89
+
90
+ constructor(map?: { [key: string]: any }) {
91
+ super(map);
92
+ }
93
+ }
94
+
95
+ export class CreateChatappTemplateRequest extends $tea.Model {
96
+ category?: string;
97
+ components?: string;
98
+ example?: string;
99
+ language?: string;
100
+ name?: string;
101
+ ownerId?: number;
102
+ resourceOwnerAccount?: string;
103
+ resourceOwnerId?: number;
104
+ templateType?: string;
105
+ static names(): { [key: string]: string } {
106
+ return {
107
+ category: 'Category',
108
+ components: 'Components',
109
+ example: 'Example',
110
+ language: 'Language',
111
+ name: 'Name',
112
+ ownerId: 'OwnerId',
113
+ resourceOwnerAccount: 'ResourceOwnerAccount',
114
+ resourceOwnerId: 'ResourceOwnerId',
115
+ templateType: 'TemplateType',
116
+ };
117
+ }
118
+
119
+ static types(): { [key: string]: any } {
120
+ return {
121
+ category: 'string',
122
+ components: 'string',
123
+ example: 'string',
124
+ language: 'string',
125
+ name: 'string',
126
+ ownerId: 'number',
127
+ resourceOwnerAccount: 'string',
128
+ resourceOwnerId: 'number',
129
+ templateType: 'string',
130
+ };
131
+ }
132
+
133
+ constructor(map?: { [key: string]: any }) {
134
+ super(map);
135
+ }
136
+ }
137
+
138
+ export class CreateChatappTemplateResponseBody extends $tea.Model {
139
+ code?: string;
140
+ data?: string;
141
+ message?: string;
142
+ requestId?: string;
143
+ static names(): { [key: string]: string } {
144
+ return {
145
+ code: 'Code',
146
+ data: 'Data',
147
+ message: 'Message',
148
+ requestId: 'RequestId',
149
+ };
150
+ }
151
+
152
+ static types(): { [key: string]: any } {
153
+ return {
154
+ code: 'string',
155
+ data: 'string',
156
+ message: 'string',
157
+ requestId: 'string',
158
+ };
159
+ }
160
+
161
+ constructor(map?: { [key: string]: any }) {
162
+ super(map);
163
+ }
164
+ }
165
+
166
+ export class CreateChatappTemplateResponse extends $tea.Model {
167
+ headers: { [key: string]: string };
168
+ body: CreateChatappTemplateResponseBody;
169
+ static names(): { [key: string]: string } {
170
+ return {
171
+ headers: 'headers',
172
+ body: 'body',
173
+ };
174
+ }
175
+
176
+ static types(): { [key: string]: any } {
177
+ return {
178
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
179
+ body: CreateChatappTemplateResponseBody,
180
+ };
181
+ }
182
+
183
+ constructor(map?: { [key: string]: any }) {
184
+ super(map);
185
+ }
186
+ }
187
+
188
+ export class DeleteChatappTemplateRequest extends $tea.Model {
189
+ ownerId?: number;
190
+ resourceOwnerAccount?: string;
191
+ resourceOwnerId?: number;
192
+ templateCode?: string;
193
+ static names(): { [key: string]: string } {
194
+ return {
195
+ ownerId: 'OwnerId',
196
+ resourceOwnerAccount: 'ResourceOwnerAccount',
197
+ resourceOwnerId: 'ResourceOwnerId',
198
+ templateCode: 'TemplateCode',
199
+ };
200
+ }
201
+
202
+ static types(): { [key: string]: any } {
203
+ return {
204
+ ownerId: 'number',
205
+ resourceOwnerAccount: 'string',
206
+ resourceOwnerId: 'number',
207
+ templateCode: 'string',
208
+ };
209
+ }
210
+
211
+ constructor(map?: { [key: string]: any }) {
212
+ super(map);
213
+ }
214
+ }
215
+
216
+ export class DeleteChatappTemplateResponseBody extends $tea.Model {
217
+ code?: string;
218
+ message?: string;
219
+ requestId?: string;
220
+ static names(): { [key: string]: string } {
221
+ return {
222
+ code: 'Code',
223
+ message: 'Message',
224
+ requestId: 'RequestId',
225
+ };
226
+ }
227
+
228
+ static types(): { [key: string]: any } {
229
+ return {
230
+ code: 'string',
231
+ message: 'string',
232
+ requestId: 'string',
233
+ };
234
+ }
235
+
236
+ constructor(map?: { [key: string]: any }) {
237
+ super(map);
238
+ }
239
+ }
240
+
241
+ export class DeleteChatappTemplateResponse extends $tea.Model {
242
+ headers: { [key: string]: string };
243
+ body: DeleteChatappTemplateResponseBody;
244
+ static names(): { [key: string]: string } {
245
+ return {
246
+ headers: 'headers',
247
+ body: 'body',
248
+ };
249
+ }
250
+
251
+ static types(): { [key: string]: any } {
252
+ return {
253
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
254
+ body: DeleteChatappTemplateResponseBody,
255
+ };
256
+ }
257
+
258
+ constructor(map?: { [key: string]: any }) {
259
+ super(map);
260
+ }
261
+ }
262
+
263
+ export class GetChatappTemplateDetailRequest extends $tea.Model {
264
+ language?: string;
265
+ ownerId?: number;
266
+ resourceOwnerAccount?: string;
267
+ resourceOwnerId?: number;
268
+ templateCode?: string;
269
+ static names(): { [key: string]: string } {
270
+ return {
271
+ language: 'Language',
272
+ ownerId: 'OwnerId',
273
+ resourceOwnerAccount: 'ResourceOwnerAccount',
274
+ resourceOwnerId: 'ResourceOwnerId',
275
+ templateCode: 'TemplateCode',
276
+ };
277
+ }
278
+
279
+ static types(): { [key: string]: any } {
280
+ return {
281
+ language: 'string',
282
+ ownerId: 'number',
283
+ resourceOwnerAccount: 'string',
284
+ resourceOwnerId: 'number',
285
+ templateCode: 'string',
286
+ };
287
+ }
288
+
289
+ constructor(map?: { [key: string]: any }) {
290
+ super(map);
291
+ }
292
+ }
293
+
294
+ export class GetChatappTemplateDetailResponseBody extends $tea.Model {
295
+ code?: string;
296
+ data?: string;
297
+ message?: string;
298
+ requestId?: string;
299
+ static names(): { [key: string]: string } {
300
+ return {
301
+ code: 'Code',
302
+ data: 'Data',
303
+ message: 'Message',
304
+ requestId: 'RequestId',
305
+ };
306
+ }
307
+
308
+ static types(): { [key: string]: any } {
309
+ return {
310
+ code: 'string',
311
+ data: 'string',
312
+ message: 'string',
313
+ requestId: 'string',
314
+ };
315
+ }
316
+
317
+ constructor(map?: { [key: string]: any }) {
318
+ super(map);
319
+ }
320
+ }
321
+
322
+ export class GetChatappTemplateDetailResponse extends $tea.Model {
323
+ headers: { [key: string]: string };
324
+ body: GetChatappTemplateDetailResponseBody;
325
+ static names(): { [key: string]: string } {
326
+ return {
327
+ headers: 'headers',
328
+ body: 'body',
329
+ };
330
+ }
331
+
332
+ static types(): { [key: string]: any } {
333
+ return {
334
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
335
+ body: GetChatappTemplateDetailResponseBody,
336
+ };
337
+ }
338
+
339
+ constructor(map?: { [key: string]: any }) {
340
+ super(map);
341
+ }
342
+ }
343
+
344
+ export class ListChatappTemplateRequest extends $tea.Model {
345
+ auditStatus?: string;
346
+ language?: string;
347
+ name?: string;
348
+ ownerId?: number;
349
+ page?: string;
350
+ resourceOwnerAccount?: string;
351
+ resourceOwnerId?: number;
352
+ static names(): { [key: string]: string } {
353
+ return {
354
+ auditStatus: 'AuditStatus',
355
+ language: 'Language',
356
+ name: 'Name',
357
+ ownerId: 'OwnerId',
358
+ page: 'Page',
359
+ resourceOwnerAccount: 'ResourceOwnerAccount',
360
+ resourceOwnerId: 'ResourceOwnerId',
361
+ };
362
+ }
363
+
364
+ static types(): { [key: string]: any } {
365
+ return {
366
+ auditStatus: 'string',
367
+ language: 'string',
368
+ name: 'string',
369
+ ownerId: 'number',
370
+ page: 'string',
371
+ resourceOwnerAccount: 'string',
372
+ resourceOwnerId: 'number',
373
+ };
374
+ }
375
+
376
+ constructor(map?: { [key: string]: any }) {
377
+ super(map);
378
+ }
379
+ }
380
+
381
+ export class ListChatappTemplateResponseBody extends $tea.Model {
382
+ code?: string;
383
+ listTemplate?: ListChatappTemplateResponseBodyListTemplate[];
384
+ message?: string;
385
+ requestId?: string;
386
+ static names(): { [key: string]: string } {
387
+ return {
388
+ code: 'Code',
389
+ listTemplate: 'ListTemplate',
390
+ message: 'Message',
391
+ requestId: 'RequestId',
392
+ };
393
+ }
394
+
395
+ static types(): { [key: string]: any } {
396
+ return {
397
+ code: 'string',
398
+ listTemplate: { 'type': 'array', 'itemType': ListChatappTemplateResponseBodyListTemplate },
399
+ message: 'string',
400
+ requestId: 'string',
401
+ };
402
+ }
403
+
404
+ constructor(map?: { [key: string]: any }) {
405
+ super(map);
406
+ }
407
+ }
408
+
409
+ export class ListChatappTemplateResponse extends $tea.Model {
410
+ headers: { [key: string]: string };
411
+ body: ListChatappTemplateResponseBody;
412
+ static names(): { [key: string]: string } {
413
+ return {
414
+ headers: 'headers',
415
+ body: 'body',
416
+ };
417
+ }
418
+
419
+ static types(): { [key: string]: any } {
420
+ return {
421
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
422
+ body: ListChatappTemplateResponseBody,
423
+ };
424
+ }
425
+
426
+ constructor(map?: { [key: string]: any }) {
427
+ super(map);
428
+ }
429
+ }
430
+
431
+ export class SendMessageRequest extends $tea.Model {
432
+ caption?: string;
433
+ channelType?: string;
434
+ fileName?: string;
435
+ from?: string;
436
+ link?: string;
437
+ messageType?: string;
438
+ ownerId?: number;
439
+ resourceOwnerAccount?: string;
440
+ resourceOwnerId?: number;
441
+ templateBodyParams?: string;
442
+ templateButtonParams?: string;
443
+ templateCode?: string;
444
+ templateHeaderParams?: string;
445
+ text?: string;
446
+ to?: string;
447
+ type?: string;
448
+ static names(): { [key: string]: string } {
449
+ return {
450
+ caption: 'Caption',
451
+ channelType: 'ChannelType',
452
+ fileName: 'FileName',
453
+ from: 'From',
454
+ link: 'Link',
455
+ messageType: 'MessageType',
456
+ ownerId: 'OwnerId',
457
+ resourceOwnerAccount: 'ResourceOwnerAccount',
458
+ resourceOwnerId: 'ResourceOwnerId',
459
+ templateBodyParams: 'TemplateBodyParams',
460
+ templateButtonParams: 'TemplateButtonParams',
461
+ templateCode: 'TemplateCode',
462
+ templateHeaderParams: 'TemplateHeaderParams',
463
+ text: 'Text',
464
+ to: 'To',
465
+ type: 'Type',
466
+ };
467
+ }
468
+
469
+ static types(): { [key: string]: any } {
470
+ return {
471
+ caption: 'string',
472
+ channelType: 'string',
473
+ fileName: 'string',
474
+ from: 'string',
475
+ link: 'string',
476
+ messageType: 'string',
477
+ ownerId: 'number',
478
+ resourceOwnerAccount: 'string',
479
+ resourceOwnerId: 'number',
480
+ templateBodyParams: 'string',
481
+ templateButtonParams: 'string',
482
+ templateCode: 'string',
483
+ templateHeaderParams: 'string',
484
+ text: 'string',
485
+ to: 'string',
486
+ type: 'string',
487
+ };
488
+ }
489
+
490
+ constructor(map?: { [key: string]: any }) {
491
+ super(map);
492
+ }
493
+ }
494
+
495
+ export class SendMessageResponseBody extends $tea.Model {
496
+ module?: SendMessageResponseBodyModule;
497
+ requestId?: string;
498
+ resultCode?: string;
499
+ resultMessage?: string;
500
+ static names(): { [key: string]: string } {
501
+ return {
502
+ module: 'Module',
503
+ requestId: 'RequestId',
504
+ resultCode: 'ResultCode',
505
+ resultMessage: 'ResultMessage',
506
+ };
507
+ }
508
+
509
+ static types(): { [key: string]: any } {
510
+ return {
511
+ module: SendMessageResponseBodyModule,
512
+ requestId: 'string',
513
+ resultCode: 'string',
514
+ resultMessage: 'string',
515
+ };
516
+ }
517
+
518
+ constructor(map?: { [key: string]: any }) {
519
+ super(map);
520
+ }
521
+ }
522
+
523
+ export class SendMessageResponse extends $tea.Model {
524
+ headers: { [key: string]: string };
525
+ body: SendMessageResponseBody;
526
+ static names(): { [key: string]: string } {
527
+ return {
528
+ headers: 'headers',
529
+ body: 'body',
530
+ };
531
+ }
532
+
533
+ static types(): { [key: string]: any } {
534
+ return {
535
+ headers: { 'type': 'map', 'keyType': 'string', 'valueType': 'string' },
536
+ body: SendMessageResponseBody,
537
+ };
538
+ }
539
+
540
+ constructor(map?: { [key: string]: any }) {
541
+ super(map);
542
+ }
543
+ }
544
+
545
+ export class CheckContactsResponseBodyContacts extends $tea.Model {
546
+ phoneNumber?: string;
547
+ status?: string;
548
+ static names(): { [key: string]: string } {
549
+ return {
550
+ phoneNumber: 'PhoneNumber',
551
+ status: 'Status',
552
+ };
553
+ }
554
+
555
+ static types(): { [key: string]: any } {
556
+ return {
557
+ phoneNumber: 'string',
558
+ status: 'string',
559
+ };
560
+ }
561
+
562
+ constructor(map?: { [key: string]: any }) {
563
+ super(map);
564
+ }
565
+ }
566
+
567
+ export class ListChatappTemplateResponseBodyListTemplate extends $tea.Model {
568
+ auditStatus?: string;
569
+ category?: string;
570
+ language?: string;
571
+ templateCode?: string;
572
+ templateName?: string;
573
+ static names(): { [key: string]: string } {
574
+ return {
575
+ auditStatus: 'AuditStatus',
576
+ category: 'Category',
577
+ language: 'Language',
578
+ templateCode: 'TemplateCode',
579
+ templateName: 'TemplateName',
580
+ };
581
+ }
582
+
583
+ static types(): { [key: string]: any } {
584
+ return {
585
+ auditStatus: 'string',
586
+ category: 'string',
587
+ language: 'string',
588
+ templateCode: 'string',
589
+ templateName: 'string',
590
+ };
591
+ }
592
+
593
+ constructor(map?: { [key: string]: any }) {
594
+ super(map);
595
+ }
596
+ }
597
+
598
+ export class SendMessageResponseBodyModule extends $tea.Model {
599
+ fromId?: string;
600
+ messageId?: string;
601
+ toId?: string;
602
+ static names(): { [key: string]: string } {
603
+ return {
604
+ fromId: 'FromId',
605
+ messageId: 'MessageId',
606
+ toId: 'ToId',
607
+ };
608
+ }
609
+
610
+ static types(): { [key: string]: any } {
611
+ return {
612
+ fromId: 'string',
613
+ messageId: 'string',
614
+ toId: 'string',
615
+ };
616
+ }
617
+
618
+ constructor(map?: { [key: string]: any }) {
619
+ super(map);
620
+ }
621
+ }
622
+
623
+
624
+ export default class Client extends OpenApi {
625
+
626
+ constructor(config: $OpenApi.Config) {
627
+ super(config);
628
+ this._endpointRule = "regional";
629
+ this.checkConfig(config);
630
+ this._endpoint = this.getEndpoint("cams", this._regionId, this._endpointRule, this._network, this._suffix, this._endpointMap, this._endpoint);
631
+ }
632
+
633
+
634
+ getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {[key: string ]: string}, endpoint: string): string {
635
+ if (!Util.empty(endpoint)) {
636
+ return endpoint;
637
+ }
638
+
639
+ if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
640
+ return endpointMap[regionId];
641
+ }
642
+
643
+ return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
644
+ }
645
+
646
+ async checkContactsWithOptions(request: CheckContactsRequest, runtime: $Util.RuntimeOptions): Promise<CheckContactsResponse> {
647
+ Util.validateModel(request);
648
+ let query = { };
649
+ if (!Util.isUnset(request.ownerId)) {
650
+ query["OwnerId"] = request.ownerId;
651
+ }
652
+
653
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
654
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
655
+ }
656
+
657
+ if (!Util.isUnset(request.resourceOwnerId)) {
658
+ query["ResourceOwnerId"] = request.resourceOwnerId;
659
+ }
660
+
661
+ let body : {[key: string ]: any} = { };
662
+ if (!Util.isUnset(request.channelType)) {
663
+ body["ChannelType"] = request.channelType;
664
+ }
665
+
666
+ if (!Util.isUnset(request.contacts)) {
667
+ body["Contacts"] = request.contacts;
668
+ }
669
+
670
+ if (!Util.isUnset(request.from)) {
671
+ body["From"] = request.from;
672
+ }
673
+
674
+ let req = new $OpenApi.OpenApiRequest({
675
+ query: OpenApiUtil.query(query),
676
+ body: OpenApiUtil.parseToMap(body),
677
+ });
678
+ let params = new $OpenApi.Params({
679
+ action: "CheckContacts",
680
+ version: "2020-06-06",
681
+ protocol: "HTTPS",
682
+ pathname: "/",
683
+ method: "POST",
684
+ authType: "AK",
685
+ style: "RPC",
686
+ reqBodyType: "formData",
687
+ bodyType: "json",
688
+ });
689
+ return $tea.cast<CheckContactsResponse>(await this.callApi(params, req, runtime), new CheckContactsResponse({}));
690
+ }
691
+
692
+ async checkContacts(request: CheckContactsRequest): Promise<CheckContactsResponse> {
693
+ let runtime = new $Util.RuntimeOptions({ });
694
+ return await this.checkContactsWithOptions(request, runtime);
695
+ }
696
+
697
+ async createChatappTemplateWithOptions(request: CreateChatappTemplateRequest, runtime: $Util.RuntimeOptions): Promise<CreateChatappTemplateResponse> {
698
+ Util.validateModel(request);
699
+ let query = { };
700
+ if (!Util.isUnset(request.category)) {
701
+ query["Category"] = request.category;
702
+ }
703
+
704
+ if (!Util.isUnset(request.components)) {
705
+ query["Components"] = request.components;
706
+ }
707
+
708
+ if (!Util.isUnset(request.example)) {
709
+ query["Example"] = request.example;
710
+ }
711
+
712
+ if (!Util.isUnset(request.language)) {
713
+ query["Language"] = request.language;
714
+ }
715
+
716
+ if (!Util.isUnset(request.name)) {
717
+ query["Name"] = request.name;
718
+ }
719
+
720
+ if (!Util.isUnset(request.ownerId)) {
721
+ query["OwnerId"] = request.ownerId;
722
+ }
723
+
724
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
725
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
726
+ }
727
+
728
+ if (!Util.isUnset(request.resourceOwnerId)) {
729
+ query["ResourceOwnerId"] = request.resourceOwnerId;
730
+ }
731
+
732
+ if (!Util.isUnset(request.templateType)) {
733
+ query["TemplateType"] = request.templateType;
734
+ }
735
+
736
+ let req = new $OpenApi.OpenApiRequest({
737
+ query: OpenApiUtil.query(query),
738
+ });
739
+ let params = new $OpenApi.Params({
740
+ action: "CreateChatappTemplate",
741
+ version: "2020-06-06",
742
+ protocol: "HTTPS",
743
+ pathname: "/",
744
+ method: "POST",
745
+ authType: "AK",
746
+ style: "RPC",
747
+ reqBodyType: "formData",
748
+ bodyType: "json",
749
+ });
750
+ return $tea.cast<CreateChatappTemplateResponse>(await this.callApi(params, req, runtime), new CreateChatappTemplateResponse({}));
751
+ }
752
+
753
+ async createChatappTemplate(request: CreateChatappTemplateRequest): Promise<CreateChatappTemplateResponse> {
754
+ let runtime = new $Util.RuntimeOptions({ });
755
+ return await this.createChatappTemplateWithOptions(request, runtime);
756
+ }
757
+
758
+ async deleteChatappTemplateWithOptions(request: DeleteChatappTemplateRequest, runtime: $Util.RuntimeOptions): Promise<DeleteChatappTemplateResponse> {
759
+ Util.validateModel(request);
760
+ let query = { };
761
+ if (!Util.isUnset(request.ownerId)) {
762
+ query["OwnerId"] = request.ownerId;
763
+ }
764
+
765
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
766
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
767
+ }
768
+
769
+ if (!Util.isUnset(request.resourceOwnerId)) {
770
+ query["ResourceOwnerId"] = request.resourceOwnerId;
771
+ }
772
+
773
+ if (!Util.isUnset(request.templateCode)) {
774
+ query["TemplateCode"] = request.templateCode;
775
+ }
776
+
777
+ let req = new $OpenApi.OpenApiRequest({
778
+ query: OpenApiUtil.query(query),
779
+ });
780
+ let params = new $OpenApi.Params({
781
+ action: "DeleteChatappTemplate",
782
+ version: "2020-06-06",
783
+ protocol: "HTTPS",
784
+ pathname: "/",
785
+ method: "POST",
786
+ authType: "AK",
787
+ style: "RPC",
788
+ reqBodyType: "formData",
789
+ bodyType: "json",
790
+ });
791
+ return $tea.cast<DeleteChatappTemplateResponse>(await this.callApi(params, req, runtime), new DeleteChatappTemplateResponse({}));
792
+ }
793
+
794
+ async deleteChatappTemplate(request: DeleteChatappTemplateRequest): Promise<DeleteChatappTemplateResponse> {
795
+ let runtime = new $Util.RuntimeOptions({ });
796
+ return await this.deleteChatappTemplateWithOptions(request, runtime);
797
+ }
798
+
799
+ async getChatappTemplateDetailWithOptions(request: GetChatappTemplateDetailRequest, runtime: $Util.RuntimeOptions): Promise<GetChatappTemplateDetailResponse> {
800
+ Util.validateModel(request);
801
+ let query = { };
802
+ if (!Util.isUnset(request.language)) {
803
+ query["Language"] = request.language;
804
+ }
805
+
806
+ if (!Util.isUnset(request.ownerId)) {
807
+ query["OwnerId"] = request.ownerId;
808
+ }
809
+
810
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
811
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
812
+ }
813
+
814
+ if (!Util.isUnset(request.resourceOwnerId)) {
815
+ query["ResourceOwnerId"] = request.resourceOwnerId;
816
+ }
817
+
818
+ if (!Util.isUnset(request.templateCode)) {
819
+ query["TemplateCode"] = request.templateCode;
820
+ }
821
+
822
+ let req = new $OpenApi.OpenApiRequest({
823
+ query: OpenApiUtil.query(query),
824
+ });
825
+ let params = new $OpenApi.Params({
826
+ action: "GetChatappTemplateDetail",
827
+ version: "2020-06-06",
828
+ protocol: "HTTPS",
829
+ pathname: "/",
830
+ method: "POST",
831
+ authType: "AK",
832
+ style: "RPC",
833
+ reqBodyType: "formData",
834
+ bodyType: "json",
835
+ });
836
+ return $tea.cast<GetChatappTemplateDetailResponse>(await this.callApi(params, req, runtime), new GetChatappTemplateDetailResponse({}));
837
+ }
838
+
839
+ async getChatappTemplateDetail(request: GetChatappTemplateDetailRequest): Promise<GetChatappTemplateDetailResponse> {
840
+ let runtime = new $Util.RuntimeOptions({ });
841
+ return await this.getChatappTemplateDetailWithOptions(request, runtime);
842
+ }
843
+
844
+ async listChatappTemplateWithOptions(request: ListChatappTemplateRequest, runtime: $Util.RuntimeOptions): Promise<ListChatappTemplateResponse> {
845
+ Util.validateModel(request);
846
+ let query = { };
847
+ if (!Util.isUnset(request.auditStatus)) {
848
+ query["AuditStatus"] = request.auditStatus;
849
+ }
850
+
851
+ if (!Util.isUnset(request.language)) {
852
+ query["Language"] = request.language;
853
+ }
854
+
855
+ if (!Util.isUnset(request.name)) {
856
+ query["Name"] = request.name;
857
+ }
858
+
859
+ if (!Util.isUnset(request.ownerId)) {
860
+ query["OwnerId"] = request.ownerId;
861
+ }
862
+
863
+ if (!Util.isUnset(request.page)) {
864
+ query["Page"] = request.page;
865
+ }
866
+
867
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
868
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
869
+ }
870
+
871
+ if (!Util.isUnset(request.resourceOwnerId)) {
872
+ query["ResourceOwnerId"] = request.resourceOwnerId;
873
+ }
874
+
875
+ let req = new $OpenApi.OpenApiRequest({
876
+ query: OpenApiUtil.query(query),
877
+ });
878
+ let params = new $OpenApi.Params({
879
+ action: "ListChatappTemplate",
880
+ version: "2020-06-06",
881
+ protocol: "HTTPS",
882
+ pathname: "/",
883
+ method: "POST",
884
+ authType: "AK",
885
+ style: "RPC",
886
+ reqBodyType: "formData",
887
+ bodyType: "json",
888
+ });
889
+ return $tea.cast<ListChatappTemplateResponse>(await this.callApi(params, req, runtime), new ListChatappTemplateResponse({}));
890
+ }
891
+
892
+ async listChatappTemplate(request: ListChatappTemplateRequest): Promise<ListChatappTemplateResponse> {
893
+ let runtime = new $Util.RuntimeOptions({ });
894
+ return await this.listChatappTemplateWithOptions(request, runtime);
895
+ }
896
+
897
+ async sendMessageWithOptions(request: SendMessageRequest, runtime: $Util.RuntimeOptions): Promise<SendMessageResponse> {
898
+ Util.validateModel(request);
899
+ let query = { };
900
+ if (!Util.isUnset(request.ownerId)) {
901
+ query["OwnerId"] = request.ownerId;
902
+ }
903
+
904
+ if (!Util.isUnset(request.resourceOwnerAccount)) {
905
+ query["ResourceOwnerAccount"] = request.resourceOwnerAccount;
906
+ }
907
+
908
+ if (!Util.isUnset(request.resourceOwnerId)) {
909
+ query["ResourceOwnerId"] = request.resourceOwnerId;
910
+ }
911
+
912
+ let body : {[key: string ]: any} = { };
913
+ if (!Util.isUnset(request.caption)) {
914
+ body["Caption"] = request.caption;
915
+ }
916
+
917
+ if (!Util.isUnset(request.channelType)) {
918
+ body["ChannelType"] = request.channelType;
919
+ }
920
+
921
+ if (!Util.isUnset(request.fileName)) {
922
+ body["FileName"] = request.fileName;
923
+ }
924
+
925
+ if (!Util.isUnset(request.from)) {
926
+ body["From"] = request.from;
927
+ }
928
+
929
+ if (!Util.isUnset(request.link)) {
930
+ body["Link"] = request.link;
931
+ }
932
+
933
+ if (!Util.isUnset(request.messageType)) {
934
+ body["MessageType"] = request.messageType;
935
+ }
936
+
937
+ if (!Util.isUnset(request.templateBodyParams)) {
938
+ body["TemplateBodyParams"] = request.templateBodyParams;
939
+ }
940
+
941
+ if (!Util.isUnset(request.templateButtonParams)) {
942
+ body["TemplateButtonParams"] = request.templateButtonParams;
943
+ }
944
+
945
+ if (!Util.isUnset(request.templateCode)) {
946
+ body["TemplateCode"] = request.templateCode;
947
+ }
948
+
949
+ if (!Util.isUnset(request.templateHeaderParams)) {
950
+ body["TemplateHeaderParams"] = request.templateHeaderParams;
951
+ }
952
+
953
+ if (!Util.isUnset(request.text)) {
954
+ body["Text"] = request.text;
955
+ }
956
+
957
+ if (!Util.isUnset(request.to)) {
958
+ body["To"] = request.to;
959
+ }
960
+
961
+ if (!Util.isUnset(request.type)) {
962
+ body["Type"] = request.type;
963
+ }
964
+
965
+ let req = new $OpenApi.OpenApiRequest({
966
+ query: OpenApiUtil.query(query),
967
+ body: OpenApiUtil.parseToMap(body),
968
+ });
969
+ let params = new $OpenApi.Params({
970
+ action: "SendMessage",
971
+ version: "2020-06-06",
972
+ protocol: "HTTPS",
973
+ pathname: "/",
974
+ method: "POST",
975
+ authType: "AK",
976
+ style: "RPC",
977
+ reqBodyType: "formData",
978
+ bodyType: "json",
979
+ });
980
+ return $tea.cast<SendMessageResponse>(await this.callApi(params, req, runtime), new SendMessageResponse({}));
981
+ }
982
+
983
+ async sendMessage(request: SendMessageRequest): Promise<SendMessageResponse> {
984
+ let runtime = new $Util.RuntimeOptions({ });
985
+ return await this.sendMessageWithOptions(request, runtime);
986
+ }
987
+
988
+ }