DysmsapiClient.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef ALIBABACLOUD_DYSMSAPI_DYSMSAPICLIENT_H_
  17. #define ALIBABACLOUD_DYSMSAPI_DYSMSAPICLIENT_H_
  18. #include <future>
  19. #include <alibabacloud/core/AsyncCallerContext.h>
  20. #include <alibabacloud/core/EndpointProvider.h>
  21. #include <alibabacloud/core/RpcServiceClient.h>
  22. #include "DysmsapiExport.h"
  23. #include "model/SendSmsRequest.h"
  24. #include "model/SendSmsResult.h"
  25. #include "model/SendBatchSmsRequest.h"
  26. #include "model/SendBatchSmsResult.h"
  27. #include "model/QuerySendDetailsRequest.h"
  28. #include "model/QuerySendDetailsResult.h"
  29. namespace AlibabaCloud
  30. {
  31. namespace Dysmsapi
  32. {
  33. class ALIBABACLOUD_DYSMSAPI_EXPORT DysmsapiClient : public RpcServiceClient
  34. {
  35. public:
  36. typedef Outcome<Error, Model::SendSmsResult> SendSmsOutcome;
  37. typedef std::future<SendSmsOutcome> SendSmsOutcomeCallable;
  38. typedef std::function<void(const DysmsapiClient*, const Model::SendSmsRequest&, const SendSmsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SendSmsAsyncHandler;
  39. typedef Outcome<Error, Model::SendBatchSmsResult> SendBatchSmsOutcome;
  40. typedef std::future<SendBatchSmsOutcome> SendBatchSmsOutcomeCallable;
  41. typedef std::function<void(const DysmsapiClient*, const Model::SendBatchSmsRequest&, const SendBatchSmsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SendBatchSmsAsyncHandler;
  42. typedef Outcome<Error, Model::QuerySendDetailsResult> QuerySendDetailsOutcome;
  43. typedef std::future<QuerySendDetailsOutcome> QuerySendDetailsOutcomeCallable;
  44. typedef std::function<void(const DysmsapiClient*, const Model::QuerySendDetailsRequest&, const QuerySendDetailsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QuerySendDetailsAsyncHandler;
  45. DysmsapiClient(const Credentials &credentials, const ClientConfiguration &configuration);
  46. DysmsapiClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
  47. DysmsapiClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
  48. ~DysmsapiClient();
  49. SendSmsOutcome sendSms(const Model::SendSmsRequest &request)const;
  50. void sendSmsAsync(const Model::SendSmsRequest& request, const SendSmsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
  51. SendSmsOutcomeCallable sendSmsCallable(const Model::SendSmsRequest& request) const;
  52. SendBatchSmsOutcome sendBatchSms(const Model::SendBatchSmsRequest &request)const;
  53. void sendBatchSmsAsync(const Model::SendBatchSmsRequest& request, const SendBatchSmsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
  54. SendBatchSmsOutcomeCallable sendBatchSmsCallable(const Model::SendBatchSmsRequest& request) const;
  55. QuerySendDetailsOutcome querySendDetails(const Model::QuerySendDetailsRequest &request)const;
  56. void querySendDetailsAsync(const Model::QuerySendDetailsRequest& request, const QuerySendDetailsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
  57. QuerySendDetailsOutcomeCallable querySendDetailsCallable(const Model::QuerySendDetailsRequest& request) const;
  58. private:
  59. std::shared_ptr<EndpointProvider> endpointProvider_;
  60. };
  61. }
  62. }
  63. #endif // !ALIBABACLOUD_DYSMSAPI_DYSMSAPICLIENT_H_