ReidClient.cc 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/reid/ReidClient.h>
  17. #include <alibabacloud/core/SimpleCredentialsProvider.h>
  18. using namespace AlibabaCloud;
  19. using namespace AlibabaCloud::Location;
  20. using namespace AlibabaCloud::Reid;
  21. using namespace AlibabaCloud::Reid::Model;
  22. namespace
  23. {
  24. const std::string SERVICE_NAME = "reid";
  25. }
  26. ReidClient::ReidClient(const Credentials &credentials, const ClientConfiguration &configuration) :
  27. RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
  28. {
  29. auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
  30. endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "1.1.8.5");
  31. }
  32. ReidClient::ReidClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
  33. RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
  34. {
  35. auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
  36. endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "1.1.8.5");
  37. }
  38. ReidClient::ReidClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
  39. RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
  40. {
  41. auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
  42. endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "1.1.8.5");
  43. }
  44. ReidClient::~ReidClient()
  45. {}
  46. ReidClient::DescribeBaseStatisticsOutcome ReidClient::describeBaseStatistics(const DescribeBaseStatisticsRequest &request) const
  47. {
  48. auto endpointOutcome = endpointProvider_->getEndpoint();
  49. if (!endpointOutcome.isSuccess())
  50. return DescribeBaseStatisticsOutcome(endpointOutcome.error());
  51. auto outcome = makeRequest(endpointOutcome.result(), request);
  52. if (outcome.isSuccess())
  53. return DescribeBaseStatisticsOutcome(DescribeBaseStatisticsResult(outcome.result()));
  54. else
  55. return DescribeBaseStatisticsOutcome(outcome.error());
  56. }
  57. void ReidClient::describeBaseStatisticsAsync(const DescribeBaseStatisticsRequest& request, const DescribeBaseStatisticsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  58. {
  59. auto fn = [this, request, handler, context]()
  60. {
  61. handler(this, request, describeBaseStatistics(request), context);
  62. };
  63. asyncExecute(new Runnable(fn));
  64. }
  65. ReidClient::DescribeBaseStatisticsOutcomeCallable ReidClient::describeBaseStatisticsCallable(const DescribeBaseStatisticsRequest &request) const
  66. {
  67. auto task = std::make_shared<std::packaged_task<DescribeBaseStatisticsOutcome()>>(
  68. [this, request]()
  69. {
  70. return this->describeBaseStatistics(request);
  71. });
  72. asyncExecute(new Runnable([task]() { (*task)(); }));
  73. return task->get_future();
  74. }
  75. ReidClient::DescribeCameraStatisticsOutcome ReidClient::describeCameraStatistics(const DescribeCameraStatisticsRequest &request) const
  76. {
  77. auto endpointOutcome = endpointProvider_->getEndpoint();
  78. if (!endpointOutcome.isSuccess())
  79. return DescribeCameraStatisticsOutcome(endpointOutcome.error());
  80. auto outcome = makeRequest(endpointOutcome.result(), request);
  81. if (outcome.isSuccess())
  82. return DescribeCameraStatisticsOutcome(DescribeCameraStatisticsResult(outcome.result()));
  83. else
  84. return DescribeCameraStatisticsOutcome(outcome.error());
  85. }
  86. void ReidClient::describeCameraStatisticsAsync(const DescribeCameraStatisticsRequest& request, const DescribeCameraStatisticsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  87. {
  88. auto fn = [this, request, handler, context]()
  89. {
  90. handler(this, request, describeCameraStatistics(request), context);
  91. };
  92. asyncExecute(new Runnable(fn));
  93. }
  94. ReidClient::DescribeCameraStatisticsOutcomeCallable ReidClient::describeCameraStatisticsCallable(const DescribeCameraStatisticsRequest &request) const
  95. {
  96. auto task = std::make_shared<std::packaged_task<DescribeCameraStatisticsOutcome()>>(
  97. [this, request]()
  98. {
  99. return this->describeCameraStatistics(request);
  100. });
  101. asyncExecute(new Runnable([task]() { (*task)(); }));
  102. return task->get_future();
  103. }
  104. ReidClient::DescribeCursorOutcome ReidClient::describeCursor(const DescribeCursorRequest &request) const
  105. {
  106. auto endpointOutcome = endpointProvider_->getEndpoint();
  107. if (!endpointOutcome.isSuccess())
  108. return DescribeCursorOutcome(endpointOutcome.error());
  109. auto outcome = makeRequest(endpointOutcome.result(), request);
  110. if (outcome.isSuccess())
  111. return DescribeCursorOutcome(DescribeCursorResult(outcome.result()));
  112. else
  113. return DescribeCursorOutcome(outcome.error());
  114. }
  115. void ReidClient::describeCursorAsync(const DescribeCursorRequest& request, const DescribeCursorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  116. {
  117. auto fn = [this, request, handler, context]()
  118. {
  119. handler(this, request, describeCursor(request), context);
  120. };
  121. asyncExecute(new Runnable(fn));
  122. }
  123. ReidClient::DescribeCursorOutcomeCallable ReidClient::describeCursorCallable(const DescribeCursorRequest &request) const
  124. {
  125. auto task = std::make_shared<std::packaged_task<DescribeCursorOutcome()>>(
  126. [this, request]()
  127. {
  128. return this->describeCursor(request);
  129. });
  130. asyncExecute(new Runnable([task]() { (*task)(); }));
  131. return task->get_future();
  132. }
  133. ReidClient::DescribeCustomerFlowByLocationOutcome ReidClient::describeCustomerFlowByLocation(const DescribeCustomerFlowByLocationRequest &request) const
  134. {
  135. auto endpointOutcome = endpointProvider_->getEndpoint();
  136. if (!endpointOutcome.isSuccess())
  137. return DescribeCustomerFlowByLocationOutcome(endpointOutcome.error());
  138. auto outcome = makeRequest(endpointOutcome.result(), request);
  139. if (outcome.isSuccess())
  140. return DescribeCustomerFlowByLocationOutcome(DescribeCustomerFlowByLocationResult(outcome.result()));
  141. else
  142. return DescribeCustomerFlowByLocationOutcome(outcome.error());
  143. }
  144. void ReidClient::describeCustomerFlowByLocationAsync(const DescribeCustomerFlowByLocationRequest& request, const DescribeCustomerFlowByLocationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  145. {
  146. auto fn = [this, request, handler, context]()
  147. {
  148. handler(this, request, describeCustomerFlowByLocation(request), context);
  149. };
  150. asyncExecute(new Runnable(fn));
  151. }
  152. ReidClient::DescribeCustomerFlowByLocationOutcomeCallable ReidClient::describeCustomerFlowByLocationCallable(const DescribeCustomerFlowByLocationRequest &request) const
  153. {
  154. auto task = std::make_shared<std::packaged_task<DescribeCustomerFlowByLocationOutcome()>>(
  155. [this, request]()
  156. {
  157. return this->describeCustomerFlowByLocation(request);
  158. });
  159. asyncExecute(new Runnable([task]() { (*task)(); }));
  160. return task->get_future();
  161. }
  162. ReidClient::DescribeDevicesOutcome ReidClient::describeDevices(const DescribeDevicesRequest &request) const
  163. {
  164. auto endpointOutcome = endpointProvider_->getEndpoint();
  165. if (!endpointOutcome.isSuccess())
  166. return DescribeDevicesOutcome(endpointOutcome.error());
  167. auto outcome = makeRequest(endpointOutcome.result(), request);
  168. if (outcome.isSuccess())
  169. return DescribeDevicesOutcome(DescribeDevicesResult(outcome.result()));
  170. else
  171. return DescribeDevicesOutcome(outcome.error());
  172. }
  173. void ReidClient::describeDevicesAsync(const DescribeDevicesRequest& request, const DescribeDevicesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  174. {
  175. auto fn = [this, request, handler, context]()
  176. {
  177. handler(this, request, describeDevices(request), context);
  178. };
  179. asyncExecute(new Runnable(fn));
  180. }
  181. ReidClient::DescribeDevicesOutcomeCallable ReidClient::describeDevicesCallable(const DescribeDevicesRequest &request) const
  182. {
  183. auto task = std::make_shared<std::packaged_task<DescribeDevicesOutcome()>>(
  184. [this, request]()
  185. {
  186. return this->describeDevices(request);
  187. });
  188. asyncExecute(new Runnable([task]() { (*task)(); }));
  189. return task->get_future();
  190. }
  191. ReidClient::DescribeHeatMapOutcome ReidClient::describeHeatMap(const DescribeHeatMapRequest &request) const
  192. {
  193. auto endpointOutcome = endpointProvider_->getEndpoint();
  194. if (!endpointOutcome.isSuccess())
  195. return DescribeHeatMapOutcome(endpointOutcome.error());
  196. auto outcome = makeRequest(endpointOutcome.result(), request);
  197. if (outcome.isSuccess())
  198. return DescribeHeatMapOutcome(DescribeHeatMapResult(outcome.result()));
  199. else
  200. return DescribeHeatMapOutcome(outcome.error());
  201. }
  202. void ReidClient::describeHeatMapAsync(const DescribeHeatMapRequest& request, const DescribeHeatMapAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  203. {
  204. auto fn = [this, request, handler, context]()
  205. {
  206. handler(this, request, describeHeatMap(request), context);
  207. };
  208. asyncExecute(new Runnable(fn));
  209. }
  210. ReidClient::DescribeHeatMapOutcomeCallable ReidClient::describeHeatMapCallable(const DescribeHeatMapRequest &request) const
  211. {
  212. auto task = std::make_shared<std::packaged_task<DescribeHeatMapOutcome()>>(
  213. [this, request]()
  214. {
  215. return this->describeHeatMap(request);
  216. });
  217. asyncExecute(new Runnable([task]() { (*task)(); }));
  218. return task->get_future();
  219. }
  220. ReidClient::DescribeImageUrlsOutcome ReidClient::describeImageUrls(const DescribeImageUrlsRequest &request) const
  221. {
  222. auto endpointOutcome = endpointProvider_->getEndpoint();
  223. if (!endpointOutcome.isSuccess())
  224. return DescribeImageUrlsOutcome(endpointOutcome.error());
  225. auto outcome = makeRequest(endpointOutcome.result(), request);
  226. if (outcome.isSuccess())
  227. return DescribeImageUrlsOutcome(DescribeImageUrlsResult(outcome.result()));
  228. else
  229. return DescribeImageUrlsOutcome(outcome.error());
  230. }
  231. void ReidClient::describeImageUrlsAsync(const DescribeImageUrlsRequest& request, const DescribeImageUrlsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  232. {
  233. auto fn = [this, request, handler, context]()
  234. {
  235. handler(this, request, describeImageUrls(request), context);
  236. };
  237. asyncExecute(new Runnable(fn));
  238. }
  239. ReidClient::DescribeImageUrlsOutcomeCallable ReidClient::describeImageUrlsCallable(const DescribeImageUrlsRequest &request) const
  240. {
  241. auto task = std::make_shared<std::packaged_task<DescribeImageUrlsOutcome()>>(
  242. [this, request]()
  243. {
  244. return this->describeImageUrls(request);
  245. });
  246. asyncExecute(new Runnable([task]() { (*task)(); }));
  247. return task->get_future();
  248. }
  249. ReidClient::DescribeIpcLiveAddressOutcome ReidClient::describeIpcLiveAddress(const DescribeIpcLiveAddressRequest &request) const
  250. {
  251. auto endpointOutcome = endpointProvider_->getEndpoint();
  252. if (!endpointOutcome.isSuccess())
  253. return DescribeIpcLiveAddressOutcome(endpointOutcome.error());
  254. auto outcome = makeRequest(endpointOutcome.result(), request);
  255. if (outcome.isSuccess())
  256. return DescribeIpcLiveAddressOutcome(DescribeIpcLiveAddressResult(outcome.result()));
  257. else
  258. return DescribeIpcLiveAddressOutcome(outcome.error());
  259. }
  260. void ReidClient::describeIpcLiveAddressAsync(const DescribeIpcLiveAddressRequest& request, const DescribeIpcLiveAddressAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  261. {
  262. auto fn = [this, request, handler, context]()
  263. {
  264. handler(this, request, describeIpcLiveAddress(request), context);
  265. };
  266. asyncExecute(new Runnable(fn));
  267. }
  268. ReidClient::DescribeIpcLiveAddressOutcomeCallable ReidClient::describeIpcLiveAddressCallable(const DescribeIpcLiveAddressRequest &request) const
  269. {
  270. auto task = std::make_shared<std::packaged_task<DescribeIpcLiveAddressOutcome()>>(
  271. [this, request]()
  272. {
  273. return this->describeIpcLiveAddress(request);
  274. });
  275. asyncExecute(new Runnable([task]() { (*task)(); }));
  276. return task->get_future();
  277. }
  278. ReidClient::DescribeOverviewDataOutcome ReidClient::describeOverviewData(const DescribeOverviewDataRequest &request) const
  279. {
  280. auto endpointOutcome = endpointProvider_->getEndpoint();
  281. if (!endpointOutcome.isSuccess())
  282. return DescribeOverviewDataOutcome(endpointOutcome.error());
  283. auto outcome = makeRequest(endpointOutcome.result(), request);
  284. if (outcome.isSuccess())
  285. return DescribeOverviewDataOutcome(DescribeOverviewDataResult(outcome.result()));
  286. else
  287. return DescribeOverviewDataOutcome(outcome.error());
  288. }
  289. void ReidClient::describeOverviewDataAsync(const DescribeOverviewDataRequest& request, const DescribeOverviewDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  290. {
  291. auto fn = [this, request, handler, context]()
  292. {
  293. handler(this, request, describeOverviewData(request), context);
  294. };
  295. asyncExecute(new Runnable(fn));
  296. }
  297. ReidClient::DescribeOverviewDataOutcomeCallable ReidClient::describeOverviewDataCallable(const DescribeOverviewDataRequest &request) const
  298. {
  299. auto task = std::make_shared<std::packaged_task<DescribeOverviewDataOutcome()>>(
  300. [this, request]()
  301. {
  302. return this->describeOverviewData(request);
  303. });
  304. asyncExecute(new Runnable([task]() { (*task)(); }));
  305. return task->get_future();
  306. }
  307. ReidClient::GetFootwearEventOutcome ReidClient::getFootwearEvent(const GetFootwearEventRequest &request) const
  308. {
  309. auto endpointOutcome = endpointProvider_->getEndpoint();
  310. if (!endpointOutcome.isSuccess())
  311. return GetFootwearEventOutcome(endpointOutcome.error());
  312. auto outcome = makeRequest(endpointOutcome.result(), request);
  313. if (outcome.isSuccess())
  314. return GetFootwearEventOutcome(GetFootwearEventResult(outcome.result()));
  315. else
  316. return GetFootwearEventOutcome(outcome.error());
  317. }
  318. void ReidClient::getFootwearEventAsync(const GetFootwearEventRequest& request, const GetFootwearEventAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  319. {
  320. auto fn = [this, request, handler, context]()
  321. {
  322. handler(this, request, getFootwearEvent(request), context);
  323. };
  324. asyncExecute(new Runnable(fn));
  325. }
  326. ReidClient::GetFootwearEventOutcomeCallable ReidClient::getFootwearEventCallable(const GetFootwearEventRequest &request) const
  327. {
  328. auto task = std::make_shared<std::packaged_task<GetFootwearEventOutcome()>>(
  329. [this, request]()
  330. {
  331. return this->getFootwearEvent(request);
  332. });
  333. asyncExecute(new Runnable([task]() { (*task)(); }));
  334. return task->get_future();
  335. }
  336. ReidClient::GetFootwearPositionOutcome ReidClient::getFootwearPosition(const GetFootwearPositionRequest &request) const
  337. {
  338. auto endpointOutcome = endpointProvider_->getEndpoint();
  339. if (!endpointOutcome.isSuccess())
  340. return GetFootwearPositionOutcome(endpointOutcome.error());
  341. auto outcome = makeRequest(endpointOutcome.result(), request);
  342. if (outcome.isSuccess())
  343. return GetFootwearPositionOutcome(GetFootwearPositionResult(outcome.result()));
  344. else
  345. return GetFootwearPositionOutcome(outcome.error());
  346. }
  347. void ReidClient::getFootwearPositionAsync(const GetFootwearPositionRequest& request, const GetFootwearPositionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  348. {
  349. auto fn = [this, request, handler, context]()
  350. {
  351. handler(this, request, getFootwearPosition(request), context);
  352. };
  353. asyncExecute(new Runnable(fn));
  354. }
  355. ReidClient::GetFootwearPositionOutcomeCallable ReidClient::getFootwearPositionCallable(const GetFootwearPositionRequest &request) const
  356. {
  357. auto task = std::make_shared<std::packaged_task<GetFootwearPositionOutcome()>>(
  358. [this, request]()
  359. {
  360. return this->getFootwearPosition(request);
  361. });
  362. asyncExecute(new Runnable([task]() { (*task)(); }));
  363. return task->get_future();
  364. }
  365. ReidClient::ImportSpecialPersonnelOutcome ReidClient::importSpecialPersonnel(const ImportSpecialPersonnelRequest &request) const
  366. {
  367. auto endpointOutcome = endpointProvider_->getEndpoint();
  368. if (!endpointOutcome.isSuccess())
  369. return ImportSpecialPersonnelOutcome(endpointOutcome.error());
  370. auto outcome = makeRequest(endpointOutcome.result(), request);
  371. if (outcome.isSuccess())
  372. return ImportSpecialPersonnelOutcome(ImportSpecialPersonnelResult(outcome.result()));
  373. else
  374. return ImportSpecialPersonnelOutcome(outcome.error());
  375. }
  376. void ReidClient::importSpecialPersonnelAsync(const ImportSpecialPersonnelRequest& request, const ImportSpecialPersonnelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  377. {
  378. auto fn = [this, request, handler, context]()
  379. {
  380. handler(this, request, importSpecialPersonnel(request), context);
  381. };
  382. asyncExecute(new Runnable(fn));
  383. }
  384. ReidClient::ImportSpecialPersonnelOutcomeCallable ReidClient::importSpecialPersonnelCallable(const ImportSpecialPersonnelRequest &request) const
  385. {
  386. auto task = std::make_shared<std::packaged_task<ImportSpecialPersonnelOutcome()>>(
  387. [this, request]()
  388. {
  389. return this->importSpecialPersonnel(request);
  390. });
  391. asyncExecute(new Runnable([task]() { (*task)(); }));
  392. return task->get_future();
  393. }
  394. ReidClient::ListActionDataOutcome ReidClient::listActionData(const ListActionDataRequest &request) const
  395. {
  396. auto endpointOutcome = endpointProvider_->getEndpoint();
  397. if (!endpointOutcome.isSuccess())
  398. return ListActionDataOutcome(endpointOutcome.error());
  399. auto outcome = makeRequest(endpointOutcome.result(), request);
  400. if (outcome.isSuccess())
  401. return ListActionDataOutcome(ListActionDataResult(outcome.result()));
  402. else
  403. return ListActionDataOutcome(outcome.error());
  404. }
  405. void ReidClient::listActionDataAsync(const ListActionDataRequest& request, const ListActionDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  406. {
  407. auto fn = [this, request, handler, context]()
  408. {
  409. handler(this, request, listActionData(request), context);
  410. };
  411. asyncExecute(new Runnable(fn));
  412. }
  413. ReidClient::ListActionDataOutcomeCallable ReidClient::listActionDataCallable(const ListActionDataRequest &request) const
  414. {
  415. auto task = std::make_shared<std::packaged_task<ListActionDataOutcome()>>(
  416. [this, request]()
  417. {
  418. return this->listActionData(request);
  419. });
  420. asyncExecute(new Runnable([task]() { (*task)(); }));
  421. return task->get_future();
  422. }
  423. ReidClient::ListDevicesImagesOutcome ReidClient::listDevicesImages(const ListDevicesImagesRequest &request) const
  424. {
  425. auto endpointOutcome = endpointProvider_->getEndpoint();
  426. if (!endpointOutcome.isSuccess())
  427. return ListDevicesImagesOutcome(endpointOutcome.error());
  428. auto outcome = makeRequest(endpointOutcome.result(), request);
  429. if (outcome.isSuccess())
  430. return ListDevicesImagesOutcome(ListDevicesImagesResult(outcome.result()));
  431. else
  432. return ListDevicesImagesOutcome(outcome.error());
  433. }
  434. void ReidClient::listDevicesImagesAsync(const ListDevicesImagesRequest& request, const ListDevicesImagesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  435. {
  436. auto fn = [this, request, handler, context]()
  437. {
  438. handler(this, request, listDevicesImages(request), context);
  439. };
  440. asyncExecute(new Runnable(fn));
  441. }
  442. ReidClient::ListDevicesImagesOutcomeCallable ReidClient::listDevicesImagesCallable(const ListDevicesImagesRequest &request) const
  443. {
  444. auto task = std::make_shared<std::packaged_task<ListDevicesImagesOutcome()>>(
  445. [this, request]()
  446. {
  447. return this->listDevicesImages(request);
  448. });
  449. asyncExecute(new Runnable([task]() { (*task)(); }));
  450. return task->get_future();
  451. }
  452. ReidClient::ListEmapOutcome ReidClient::listEmap(const ListEmapRequest &request) const
  453. {
  454. auto endpointOutcome = endpointProvider_->getEndpoint();
  455. if (!endpointOutcome.isSuccess())
  456. return ListEmapOutcome(endpointOutcome.error());
  457. auto outcome = makeRequest(endpointOutcome.result(), request);
  458. if (outcome.isSuccess())
  459. return ListEmapOutcome(ListEmapResult(outcome.result()));
  460. else
  461. return ListEmapOutcome(outcome.error());
  462. }
  463. void ReidClient::listEmapAsync(const ListEmapRequest& request, const ListEmapAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  464. {
  465. auto fn = [this, request, handler, context]()
  466. {
  467. handler(this, request, listEmap(request), context);
  468. };
  469. asyncExecute(new Runnable(fn));
  470. }
  471. ReidClient::ListEmapOutcomeCallable ReidClient::listEmapCallable(const ListEmapRequest &request) const
  472. {
  473. auto task = std::make_shared<std::packaged_task<ListEmapOutcome()>>(
  474. [this, request]()
  475. {
  476. return this->listEmap(request);
  477. });
  478. asyncExecute(new Runnable([task]() { (*task)(); }));
  479. return task->get_future();
  480. }
  481. ReidClient::ListLocationOutcome ReidClient::listLocation(const ListLocationRequest &request) const
  482. {
  483. auto endpointOutcome = endpointProvider_->getEndpoint();
  484. if (!endpointOutcome.isSuccess())
  485. return ListLocationOutcome(endpointOutcome.error());
  486. auto outcome = makeRequest(endpointOutcome.result(), request);
  487. if (outcome.isSuccess())
  488. return ListLocationOutcome(ListLocationResult(outcome.result()));
  489. else
  490. return ListLocationOutcome(outcome.error());
  491. }
  492. void ReidClient::listLocationAsync(const ListLocationRequest& request, const ListLocationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  493. {
  494. auto fn = [this, request, handler, context]()
  495. {
  496. handler(this, request, listLocation(request), context);
  497. };
  498. asyncExecute(new Runnable(fn));
  499. }
  500. ReidClient::ListLocationOutcomeCallable ReidClient::listLocationCallable(const ListLocationRequest &request) const
  501. {
  502. auto task = std::make_shared<std::packaged_task<ListLocationOutcome()>>(
  503. [this, request]()
  504. {
  505. return this->listLocation(request);
  506. });
  507. asyncExecute(new Runnable([task]() { (*task)(); }));
  508. return task->get_future();
  509. }
  510. ReidClient::ListMaskDetectionResultsOutcome ReidClient::listMaskDetectionResults(const ListMaskDetectionResultsRequest &request) const
  511. {
  512. auto endpointOutcome = endpointProvider_->getEndpoint();
  513. if (!endpointOutcome.isSuccess())
  514. return ListMaskDetectionResultsOutcome(endpointOutcome.error());
  515. auto outcome = makeRequest(endpointOutcome.result(), request);
  516. if (outcome.isSuccess())
  517. return ListMaskDetectionResultsOutcome(ListMaskDetectionResultsResult(outcome.result()));
  518. else
  519. return ListMaskDetectionResultsOutcome(outcome.error());
  520. }
  521. void ReidClient::listMaskDetectionResultsAsync(const ListMaskDetectionResultsRequest& request, const ListMaskDetectionResultsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  522. {
  523. auto fn = [this, request, handler, context]()
  524. {
  525. handler(this, request, listMaskDetectionResults(request), context);
  526. };
  527. asyncExecute(new Runnable(fn));
  528. }
  529. ReidClient::ListMaskDetectionResultsOutcomeCallable ReidClient::listMaskDetectionResultsCallable(const ListMaskDetectionResultsRequest &request) const
  530. {
  531. auto task = std::make_shared<std::packaged_task<ListMaskDetectionResultsOutcome()>>(
  532. [this, request]()
  533. {
  534. return this->listMaskDetectionResults(request);
  535. });
  536. asyncExecute(new Runnable([task]() { (*task)(); }));
  537. return task->get_future();
  538. }
  539. ReidClient::ListPersonByImageOutcome ReidClient::listPersonByImage(const ListPersonByImageRequest &request) const
  540. {
  541. auto endpointOutcome = endpointProvider_->getEndpoint();
  542. if (!endpointOutcome.isSuccess())
  543. return ListPersonByImageOutcome(endpointOutcome.error());
  544. auto outcome = makeRequest(endpointOutcome.result(), request);
  545. if (outcome.isSuccess())
  546. return ListPersonByImageOutcome(ListPersonByImageResult(outcome.result()));
  547. else
  548. return ListPersonByImageOutcome(outcome.error());
  549. }
  550. void ReidClient::listPersonByImageAsync(const ListPersonByImageRequest& request, const ListPersonByImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  551. {
  552. auto fn = [this, request, handler, context]()
  553. {
  554. handler(this, request, listPersonByImage(request), context);
  555. };
  556. asyncExecute(new Runnable(fn));
  557. }
  558. ReidClient::ListPersonByImageOutcomeCallable ReidClient::listPersonByImageCallable(const ListPersonByImageRequest &request) const
  559. {
  560. auto task = std::make_shared<std::packaged_task<ListPersonByImageOutcome()>>(
  561. [this, request]()
  562. {
  563. return this->listPersonByImage(request);
  564. });
  565. asyncExecute(new Runnable([task]() { (*task)(); }));
  566. return task->get_future();
  567. }
  568. ReidClient::ListStoreOutcome ReidClient::listStore(const ListStoreRequest &request) const
  569. {
  570. auto endpointOutcome = endpointProvider_->getEndpoint();
  571. if (!endpointOutcome.isSuccess())
  572. return ListStoreOutcome(endpointOutcome.error());
  573. auto outcome = makeRequest(endpointOutcome.result(), request);
  574. if (outcome.isSuccess())
  575. return ListStoreOutcome(ListStoreResult(outcome.result()));
  576. else
  577. return ListStoreOutcome(outcome.error());
  578. }
  579. void ReidClient::listStoreAsync(const ListStoreRequest& request, const ListStoreAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  580. {
  581. auto fn = [this, request, handler, context]()
  582. {
  583. handler(this, request, listStore(request), context);
  584. };
  585. asyncExecute(new Runnable(fn));
  586. }
  587. ReidClient::ListStoreOutcomeCallable ReidClient::listStoreCallable(const ListStoreRequest &request) const
  588. {
  589. auto task = std::make_shared<std::packaged_task<ListStoreOutcome()>>(
  590. [this, request]()
  591. {
  592. return this->listStore(request);
  593. });
  594. asyncExecute(new Runnable([task]() { (*task)(); }));
  595. return task->get_future();
  596. }
  597. ReidClient::PullActionDataOutcome ReidClient::pullActionData(const PullActionDataRequest &request) const
  598. {
  599. auto endpointOutcome = endpointProvider_->getEndpoint();
  600. if (!endpointOutcome.isSuccess())
  601. return PullActionDataOutcome(endpointOutcome.error());
  602. auto outcome = makeRequest(endpointOutcome.result(), request);
  603. if (outcome.isSuccess())
  604. return PullActionDataOutcome(PullActionDataResult(outcome.result()));
  605. else
  606. return PullActionDataOutcome(outcome.error());
  607. }
  608. void ReidClient::pullActionDataAsync(const PullActionDataRequest& request, const PullActionDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  609. {
  610. auto fn = [this, request, handler, context]()
  611. {
  612. handler(this, request, pullActionData(request), context);
  613. };
  614. asyncExecute(new Runnable(fn));
  615. }
  616. ReidClient::PullActionDataOutcomeCallable ReidClient::pullActionDataCallable(const PullActionDataRequest &request) const
  617. {
  618. auto task = std::make_shared<std::packaged_task<PullActionDataOutcome()>>(
  619. [this, request]()
  620. {
  621. return this->pullActionData(request);
  622. });
  623. asyncExecute(new Runnable([task]() { (*task)(); }));
  624. return task->get_future();
  625. }
  626. ReidClient::PullTakeShoesEventOutcome ReidClient::pullTakeShoesEvent(const PullTakeShoesEventRequest &request) const
  627. {
  628. auto endpointOutcome = endpointProvider_->getEndpoint();
  629. if (!endpointOutcome.isSuccess())
  630. return PullTakeShoesEventOutcome(endpointOutcome.error());
  631. auto outcome = makeRequest(endpointOutcome.result(), request);
  632. if (outcome.isSuccess())
  633. return PullTakeShoesEventOutcome(PullTakeShoesEventResult(outcome.result()));
  634. else
  635. return PullTakeShoesEventOutcome(outcome.error());
  636. }
  637. void ReidClient::pullTakeShoesEventAsync(const PullTakeShoesEventRequest& request, const PullTakeShoesEventAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  638. {
  639. auto fn = [this, request, handler, context]()
  640. {
  641. handler(this, request, pullTakeShoesEvent(request), context);
  642. };
  643. asyncExecute(new Runnable(fn));
  644. }
  645. ReidClient::PullTakeShoesEventOutcomeCallable ReidClient::pullTakeShoesEventCallable(const PullTakeShoesEventRequest &request) const
  646. {
  647. auto task = std::make_shared<std::packaged_task<PullTakeShoesEventOutcome()>>(
  648. [this, request]()
  649. {
  650. return this->pullTakeShoesEvent(request);
  651. });
  652. asyncExecute(new Runnable([task]() { (*task)(); }));
  653. return task->get_future();
  654. }
  655. ReidClient::PullTryOnShoesEventOutcome ReidClient::pullTryOnShoesEvent(const PullTryOnShoesEventRequest &request) const
  656. {
  657. auto endpointOutcome = endpointProvider_->getEndpoint();
  658. if (!endpointOutcome.isSuccess())
  659. return PullTryOnShoesEventOutcome(endpointOutcome.error());
  660. auto outcome = makeRequest(endpointOutcome.result(), request);
  661. if (outcome.isSuccess())
  662. return PullTryOnShoesEventOutcome(PullTryOnShoesEventResult(outcome.result()));
  663. else
  664. return PullTryOnShoesEventOutcome(outcome.error());
  665. }
  666. void ReidClient::pullTryOnShoesEventAsync(const PullTryOnShoesEventRequest& request, const PullTryOnShoesEventAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
  667. {
  668. auto fn = [this, request, handler, context]()
  669. {
  670. handler(this, request, pullTryOnShoesEvent(request), context);
  671. };
  672. asyncExecute(new Runnable(fn));
  673. }
  674. ReidClient::PullTryOnShoesEventOutcomeCallable ReidClient::pullTryOnShoesEventCallable(const PullTryOnShoesEventRequest &request) const
  675. {
  676. auto task = std::make_shared<std::packaged_task<PullTryOnShoesEventOutcome()>>(
  677. [this, request]()
  678. {
  679. return this->pullTryOnShoesEvent(request);
  680. });
  681. asyncExecute(new Runnable([task]() { (*task)(); }));
  682. return task->get_future();
  683. }