-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathCreateWorkitemResult.cc
120 lines (107 loc) · 4.27 KB
/
CreateWorkitemResult.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
/*
* 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/devops/model/CreateWorkitemResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Devops;
using namespace AlibabaCloud::Devops::Model;
CreateWorkitemResult::CreateWorkitemResult() :
ServiceResult()
{}
CreateWorkitemResult::CreateWorkitemResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CreateWorkitemResult::~CreateWorkitemResult()
{}
void CreateWorkitemResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto workitemNode = value["workitem"];
if(!workitemNode["identifier"].isNull())
workitem_.identifier = workitemNode["identifier"].asString();
if(!workitemNode["subject"].isNull())
workitem_.subject = workitemNode["subject"].asString();
if(!workitemNode["document"].isNull())
workitem_.document = workitemNode["document"].asString();
if(!workitemNode["assignedTo"].isNull())
workitem_.assignedTo = workitemNode["assignedTo"].asString();
if(!workitemNode["status"].isNull())
workitem_.status = workitemNode["status"].asString();
if(!workitemNode["statusStageIdentifier"].isNull())
workitem_.statusStageIdentifier = workitemNode["statusStageIdentifier"].asString();
if(!workitemNode["spaceIdentifier"].isNull())
workitem_.spaceIdentifier = workitemNode["spaceIdentifier"].asString();
if(!workitemNode["spaceName"].isNull())
workitem_.spaceName = workitemNode["spaceName"].asString();
if(!workitemNode["spaceType"].isNull())
workitem_.spaceType = workitemNode["spaceType"].asString();
if(!workitemNode["logicalStatus"].isNull())
workitem_.logicalStatus = workitemNode["logicalStatus"].asString();
if(!workitemNode["categoryIdentifier"].isNull())
workitem_.categoryIdentifier = workitemNode["categoryIdentifier"].asString();
if(!workitemNode["parentIdentifier"].isNull())
workitem_.parentIdentifier = workitemNode["parentIdentifier"].asString();
if(!workitemNode["workitemTypeIdentifier"].isNull())
workitem_.workitemTypeIdentifier = workitemNode["workitemTypeIdentifier"].asString();
if(!workitemNode["updateStatusAt"].isNull())
workitem_.updateStatusAt = std::stol(workitemNode["updateStatusAt"].asString());
if(!workitemNode["serialNumber"].isNull())
workitem_.serialNumber = workitemNode["serialNumber"].asString();
if(!workitemNode["gmtCreate"].isNull())
workitem_.gmtCreate = std::stol(workitemNode["gmtCreate"].asString());
if(!workitemNode["gmtModified"].isNull())
workitem_.gmtModified = std::stol(workitemNode["gmtModified"].asString());
if(!workitemNode["creator"].isNull())
workitem_.creator = workitemNode["creator"].asString();
if(!workitemNode["modifier"].isNull())
workitem_.modifier = workitemNode["modifier"].asString();
if(!workitemNode["statusIdentifier"].isNull())
workitem_.statusIdentifier = workitemNode["statusIdentifier"].asString();
if(!workitemNode["sprintIdentifier"].isNull())
workitem_.sprintIdentifier = workitemNode["sprintIdentifier"].asString();
if(!value["requestId"].isNull())
requestId_ = value["requestId"].asString();
if(!value["errorMsg"].isNull())
errorMsg_ = value["errorMsg"].asString();
if(!value["errorCode"].isNull())
errorCode_ = value["errorCode"].asString();
if(!value["success"].isNull())
success_ = value["success"].asString() == "true";
}
CreateWorkitemResult::Workitem CreateWorkitemResult::getWorkitem()const
{
return workitem_;
}
std::string CreateWorkitemResult::getRequestId()const
{
return requestId_;
}
std::string CreateWorkitemResult::getErrorMsg()const
{
return errorMsg_;
}
std::string CreateWorkitemResult::getErrorCode()const
{
return errorCode_;
}
bool CreateWorkitemResult::getSuccess()const
{
return success_;
}