-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathChatbotClient.cc
2033 lines (1640 loc) · 66.3 KB
/
ChatbotClient.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/chatbot/ChatbotClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Chatbot;
using namespace AlibabaCloud::Chatbot::Model;
namespace
{
const std::string SERVICE_NAME = "Chatbot";
}
ChatbotClient::ChatbotClient(const Credentials &credentials, const ClientConfiguration &configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "chatbot");
}
ChatbotClient::ChatbotClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "chatbot");
}
ChatbotClient::ChatbotClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "chatbot");
}
ChatbotClient::~ChatbotClient()
{}
ChatbotClient::ActivatePerspectiveOutcome ChatbotClient::activatePerspective(const ActivatePerspectiveRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ActivatePerspectiveOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ActivatePerspectiveOutcome(ActivatePerspectiveResult(outcome.result()));
else
return ActivatePerspectiveOutcome(outcome.error());
}
void ChatbotClient::activatePerspectiveAsync(const ActivatePerspectiveRequest& request, const ActivatePerspectiveAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, activatePerspective(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::ActivatePerspectiveOutcomeCallable ChatbotClient::activatePerspectiveCallable(const ActivatePerspectiveRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ActivatePerspectiveOutcome()>>(
[this, request]()
{
return this->activatePerspective(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::AddSynonymOutcome ChatbotClient::addSynonym(const AddSynonymRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return AddSynonymOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return AddSynonymOutcome(AddSynonymResult(outcome.result()));
else
return AddSynonymOutcome(outcome.error());
}
void ChatbotClient::addSynonymAsync(const AddSynonymRequest& request, const AddSynonymAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, addSynonym(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::AddSynonymOutcomeCallable ChatbotClient::addSynonymCallable(const AddSynonymRequest &request) const
{
auto task = std::make_shared<std::packaged_task<AddSynonymOutcome()>>(
[this, request]()
{
return this->addSynonym(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::AppendEntityMemberOutcome ChatbotClient::appendEntityMember(const AppendEntityMemberRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return AppendEntityMemberOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return AppendEntityMemberOutcome(AppendEntityMemberResult(outcome.result()));
else
return AppendEntityMemberOutcome(outcome.error());
}
void ChatbotClient::appendEntityMemberAsync(const AppendEntityMemberRequest& request, const AppendEntityMemberAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, appendEntityMember(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::AppendEntityMemberOutcomeCallable ChatbotClient::appendEntityMemberCallable(const AppendEntityMemberRequest &request) const
{
auto task = std::make_shared<std::packaged_task<AppendEntityMemberOutcome()>>(
[this, request]()
{
return this->appendEntityMember(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::ChatOutcome ChatbotClient::chat(const ChatRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ChatOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ChatOutcome(ChatResult(outcome.result()));
else
return ChatOutcome(outcome.error());
}
void ChatbotClient::chatAsync(const ChatRequest& request, const ChatAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, chat(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::ChatOutcomeCallable ChatbotClient::chatCallable(const ChatRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ChatOutcome()>>(
[this, request]()
{
return this->chat(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateBotOutcome ChatbotClient::createBot(const CreateBotRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateBotOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateBotOutcome(CreateBotResult(outcome.result()));
else
return CreateBotOutcome(outcome.error());
}
void ChatbotClient::createBotAsync(const CreateBotRequest& request, const CreateBotAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createBot(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateBotOutcomeCallable ChatbotClient::createBotCallable(const CreateBotRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateBotOutcome()>>(
[this, request]()
{
return this->createBot(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateCategoryOutcome ChatbotClient::createCategory(const CreateCategoryRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateCategoryOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateCategoryOutcome(CreateCategoryResult(outcome.result()));
else
return CreateCategoryOutcome(outcome.error());
}
void ChatbotClient::createCategoryAsync(const CreateCategoryRequest& request, const CreateCategoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createCategory(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateCategoryOutcomeCallable ChatbotClient::createCategoryCallable(const CreateCategoryRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateCategoryOutcome()>>(
[this, request]()
{
return this->createCategory(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateCoreWordOutcome ChatbotClient::createCoreWord(const CreateCoreWordRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateCoreWordOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateCoreWordOutcome(CreateCoreWordResult(outcome.result()));
else
return CreateCoreWordOutcome(outcome.error());
}
void ChatbotClient::createCoreWordAsync(const CreateCoreWordRequest& request, const CreateCoreWordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createCoreWord(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateCoreWordOutcomeCallable ChatbotClient::createCoreWordCallable(const CreateCoreWordRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateCoreWordOutcome()>>(
[this, request]()
{
return this->createCoreWord(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateDialogOutcome ChatbotClient::createDialog(const CreateDialogRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateDialogOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateDialogOutcome(CreateDialogResult(outcome.result()));
else
return CreateDialogOutcome(outcome.error());
}
void ChatbotClient::createDialogAsync(const CreateDialogRequest& request, const CreateDialogAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createDialog(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateDialogOutcomeCallable ChatbotClient::createDialogCallable(const CreateDialogRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateDialogOutcome()>>(
[this, request]()
{
return this->createDialog(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateEntityOutcome ChatbotClient::createEntity(const CreateEntityRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateEntityOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateEntityOutcome(CreateEntityResult(outcome.result()));
else
return CreateEntityOutcome(outcome.error());
}
void ChatbotClient::createEntityAsync(const CreateEntityRequest& request, const CreateEntityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createEntity(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateEntityOutcomeCallable ChatbotClient::createEntityCallable(const CreateEntityRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateEntityOutcome()>>(
[this, request]()
{
return this->createEntity(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateIntentOutcome ChatbotClient::createIntent(const CreateIntentRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateIntentOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateIntentOutcome(CreateIntentResult(outcome.result()));
else
return CreateIntentOutcome(outcome.error());
}
void ChatbotClient::createIntentAsync(const CreateIntentRequest& request, const CreateIntentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createIntent(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateIntentOutcomeCallable ChatbotClient::createIntentCallable(const CreateIntentRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateIntentOutcome()>>(
[this, request]()
{
return this->createIntent(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreateKnowledgeOutcome ChatbotClient::createKnowledge(const CreateKnowledgeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreateKnowledgeOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreateKnowledgeOutcome(CreateKnowledgeResult(outcome.result()));
else
return CreateKnowledgeOutcome(outcome.error());
}
void ChatbotClient::createKnowledgeAsync(const CreateKnowledgeRequest& request, const CreateKnowledgeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createKnowledge(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreateKnowledgeOutcomeCallable ChatbotClient::createKnowledgeCallable(const CreateKnowledgeRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreateKnowledgeOutcome()>>(
[this, request]()
{
return this->createKnowledge(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::CreatePerspectiveOutcome ChatbotClient::createPerspective(const CreatePerspectiveRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return CreatePerspectiveOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return CreatePerspectiveOutcome(CreatePerspectiveResult(outcome.result()));
else
return CreatePerspectiveOutcome(outcome.error());
}
void ChatbotClient::createPerspectiveAsync(const CreatePerspectiveRequest& request, const CreatePerspectiveAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, createPerspective(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::CreatePerspectiveOutcomeCallable ChatbotClient::createPerspectiveCallable(const CreatePerspectiveRequest &request) const
{
auto task = std::make_shared<std::packaged_task<CreatePerspectiveOutcome()>>(
[this, request]()
{
return this->createPerspective(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteBotOutcome ChatbotClient::deleteBot(const DeleteBotRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteBotOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteBotOutcome(DeleteBotResult(outcome.result()));
else
return DeleteBotOutcome(outcome.error());
}
void ChatbotClient::deleteBotAsync(const DeleteBotRequest& request, const DeleteBotAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteBot(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteBotOutcomeCallable ChatbotClient::deleteBotCallable(const DeleteBotRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteBotOutcome()>>(
[this, request]()
{
return this->deleteBot(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteCategoryOutcome ChatbotClient::deleteCategory(const DeleteCategoryRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteCategoryOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteCategoryOutcome(DeleteCategoryResult(outcome.result()));
else
return DeleteCategoryOutcome(outcome.error());
}
void ChatbotClient::deleteCategoryAsync(const DeleteCategoryRequest& request, const DeleteCategoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteCategory(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteCategoryOutcomeCallable ChatbotClient::deleteCategoryCallable(const DeleteCategoryRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteCategoryOutcome()>>(
[this, request]()
{
return this->deleteCategory(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteCoreWordOutcome ChatbotClient::deleteCoreWord(const DeleteCoreWordRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteCoreWordOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteCoreWordOutcome(DeleteCoreWordResult(outcome.result()));
else
return DeleteCoreWordOutcome(outcome.error());
}
void ChatbotClient::deleteCoreWordAsync(const DeleteCoreWordRequest& request, const DeleteCoreWordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteCoreWord(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteCoreWordOutcomeCallable ChatbotClient::deleteCoreWordCallable(const DeleteCoreWordRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteCoreWordOutcome()>>(
[this, request]()
{
return this->deleteCoreWord(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteDialogOutcome ChatbotClient::deleteDialog(const DeleteDialogRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteDialogOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteDialogOutcome(DeleteDialogResult(outcome.result()));
else
return DeleteDialogOutcome(outcome.error());
}
void ChatbotClient::deleteDialogAsync(const DeleteDialogRequest& request, const DeleteDialogAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteDialog(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteDialogOutcomeCallable ChatbotClient::deleteDialogCallable(const DeleteDialogRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteDialogOutcome()>>(
[this, request]()
{
return this->deleteDialog(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteEntityOutcome ChatbotClient::deleteEntity(const DeleteEntityRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteEntityOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteEntityOutcome(DeleteEntityResult(outcome.result()));
else
return DeleteEntityOutcome(outcome.error());
}
void ChatbotClient::deleteEntityAsync(const DeleteEntityRequest& request, const DeleteEntityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteEntity(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteEntityOutcomeCallable ChatbotClient::deleteEntityCallable(const DeleteEntityRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteEntityOutcome()>>(
[this, request]()
{
return this->deleteEntity(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteIntentOutcome ChatbotClient::deleteIntent(const DeleteIntentRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteIntentOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteIntentOutcome(DeleteIntentResult(outcome.result()));
else
return DeleteIntentOutcome(outcome.error());
}
void ChatbotClient::deleteIntentAsync(const DeleteIntentRequest& request, const DeleteIntentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteIntent(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteIntentOutcomeCallable ChatbotClient::deleteIntentCallable(const DeleteIntentRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteIntentOutcome()>>(
[this, request]()
{
return this->deleteIntent(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DeleteKnowledgeOutcome ChatbotClient::deleteKnowledge(const DeleteKnowledgeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DeleteKnowledgeOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DeleteKnowledgeOutcome(DeleteKnowledgeResult(outcome.result()));
else
return DeleteKnowledgeOutcome(outcome.error());
}
void ChatbotClient::deleteKnowledgeAsync(const DeleteKnowledgeRequest& request, const DeleteKnowledgeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, deleteKnowledge(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DeleteKnowledgeOutcomeCallable ChatbotClient::deleteKnowledgeCallable(const DeleteKnowledgeRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DeleteKnowledgeOutcome()>>(
[this, request]()
{
return this->deleteKnowledge(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeBotOutcome ChatbotClient::describeBot(const DescribeBotRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeBotOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeBotOutcome(DescribeBotResult(outcome.result()));
else
return DescribeBotOutcome(outcome.error());
}
void ChatbotClient::describeBotAsync(const DescribeBotRequest& request, const DescribeBotAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeBot(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeBotOutcomeCallable ChatbotClient::describeBotCallable(const DescribeBotRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeBotOutcome()>>(
[this, request]()
{
return this->describeBot(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeCategoryOutcome ChatbotClient::describeCategory(const DescribeCategoryRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeCategoryOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeCategoryOutcome(DescribeCategoryResult(outcome.result()));
else
return DescribeCategoryOutcome(outcome.error());
}
void ChatbotClient::describeCategoryAsync(const DescribeCategoryRequest& request, const DescribeCategoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeCategory(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeCategoryOutcomeCallable ChatbotClient::describeCategoryCallable(const DescribeCategoryRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeCategoryOutcome()>>(
[this, request]()
{
return this->describeCategory(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeCoreWordOutcome ChatbotClient::describeCoreWord(const DescribeCoreWordRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeCoreWordOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeCoreWordOutcome(DescribeCoreWordResult(outcome.result()));
else
return DescribeCoreWordOutcome(outcome.error());
}
void ChatbotClient::describeCoreWordAsync(const DescribeCoreWordRequest& request, const DescribeCoreWordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeCoreWord(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeCoreWordOutcomeCallable ChatbotClient::describeCoreWordCallable(const DescribeCoreWordRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeCoreWordOutcome()>>(
[this, request]()
{
return this->describeCoreWord(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeDialogOutcome ChatbotClient::describeDialog(const DescribeDialogRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeDialogOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeDialogOutcome(DescribeDialogResult(outcome.result()));
else
return DescribeDialogOutcome(outcome.error());
}
void ChatbotClient::describeDialogAsync(const DescribeDialogRequest& request, const DescribeDialogAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeDialog(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeDialogOutcomeCallable ChatbotClient::describeDialogCallable(const DescribeDialogRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeDialogOutcome()>>(
[this, request]()
{
return this->describeDialog(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeDialogFlowOutcome ChatbotClient::describeDialogFlow(const DescribeDialogFlowRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeDialogFlowOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeDialogFlowOutcome(DescribeDialogFlowResult(outcome.result()));
else
return DescribeDialogFlowOutcome(outcome.error());
}
void ChatbotClient::describeDialogFlowAsync(const DescribeDialogFlowRequest& request, const DescribeDialogFlowAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeDialogFlow(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeDialogFlowOutcomeCallable ChatbotClient::describeDialogFlowCallable(const DescribeDialogFlowRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeDialogFlowOutcome()>>(
[this, request]()
{
return this->describeDialogFlow(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeEntitiesOutcome ChatbotClient::describeEntities(const DescribeEntitiesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeEntitiesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeEntitiesOutcome(DescribeEntitiesResult(outcome.result()));
else
return DescribeEntitiesOutcome(outcome.error());
}
void ChatbotClient::describeEntitiesAsync(const DescribeEntitiesRequest& request, const DescribeEntitiesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeEntities(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeEntitiesOutcomeCallable ChatbotClient::describeEntitiesCallable(const DescribeEntitiesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeEntitiesOutcome()>>(
[this, request]()
{
return this->describeEntities(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeIntentOutcome ChatbotClient::describeIntent(const DescribeIntentRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeIntentOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeIntentOutcome(DescribeIntentResult(outcome.result()));
else
return DescribeIntentOutcome(outcome.error());
}
void ChatbotClient::describeIntentAsync(const DescribeIntentRequest& request, const DescribeIntentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeIntent(request), context);
};
asyncExecute(new Runnable(fn));
}
ChatbotClient::DescribeIntentOutcomeCallable ChatbotClient::describeIntentCallable(const DescribeIntentRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeIntentOutcome()>>(
[this, request]()
{
return this->describeIntent(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ChatbotClient::DescribeKnowledgeOutcome ChatbotClient::describeKnowledge(const DescribeKnowledgeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeKnowledgeOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeKnowledgeOutcome(DescribeKnowledgeResult(outcome.result()));
else