CreateScriptResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/outboundbot/model/CreateScriptResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::OutboundBot;
  19. using namespace AlibabaCloud::OutboundBot::Model;
  20. CreateScriptResult::CreateScriptResult() :
  21. ServiceResult()
  22. {}
  23. CreateScriptResult::CreateScriptResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. CreateScriptResult::~CreateScriptResult()
  29. {}
  30. void CreateScriptResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto scriptNode = value["Script"];
  37. if(!scriptNode["DebugStatus"].isNull())
  38. script_.debugStatus = scriptNode["DebugStatus"].asString();
  39. if(!scriptNode["Industry"].isNull())
  40. script_.industry = scriptNode["Industry"].asString();
  41. if(!scriptNode["IsDebugDrafted"].isNull())
  42. script_.isDebugDrafted = scriptNode["IsDebugDrafted"].asString() == "true";
  43. if(!scriptNode["IsDrafted"].isNull())
  44. script_.isDrafted = scriptNode["IsDrafted"].asString() == "true";
  45. if(!scriptNode["Scene"].isNull())
  46. script_.scene = scriptNode["Scene"].asString();
  47. if(!scriptNode["ScriptDescription"].isNull())
  48. script_.scriptDescription = scriptNode["ScriptDescription"].asString();
  49. if(!scriptNode["ScriptId"].isNull())
  50. script_.scriptId = scriptNode["ScriptId"].asString();
  51. if(!scriptNode["ScriptName"].isNull())
  52. script_.scriptName = scriptNode["ScriptName"].asString();
  53. if(!scriptNode["Status"].isNull())
  54. script_.status = scriptNode["Status"].asString();
  55. if(!scriptNode["UpdateTime"].isNull())
  56. script_.updateTime = std::stol(scriptNode["UpdateTime"].asString());
  57. if(!value["Code"].isNull())
  58. code_ = value["Code"].asString();
  59. if(!value["HttpStatusCode"].isNull())
  60. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  61. if(!value["Message"].isNull())
  62. message_ = value["Message"].asString();
  63. if(!value["Success"].isNull())
  64. success_ = value["Success"].asString() == "true";
  65. if(!value["ChatbotId"].isNull())
  66. chatbotId_ = value["ChatbotId"].asString();
  67. }
  68. CreateScriptResult::Script CreateScriptResult::getScript()const
  69. {
  70. return script_;
  71. }
  72. std::string CreateScriptResult::getChatbotId()const
  73. {
  74. return chatbotId_;
  75. }
  76. std::string CreateScriptResult::getMessage()const
  77. {
  78. return message_;
  79. }
  80. int CreateScriptResult::getHttpStatusCode()const
  81. {
  82. return httpStatusCode_;
  83. }
  84. std::string CreateScriptResult::getCode()const
  85. {
  86. return code_;
  87. }
  88. bool CreateScriptResult::getSuccess()const
  89. {
  90. return success_;
  91. }