-
Notifications
You must be signed in to change notification settings - Fork 12
/
analyticssurvey.go
192 lines (128 loc) · 5.06 KB
/
analyticssurvey.go
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
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Analyticssurvey
type Analyticssurvey struct {
// EventTime - Specifies when an event occurred. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
EventTime *time.Time `json:"eventTime,omitempty"`
// QueueId - The ID of the associated queue
QueueId *string `json:"queueId,omitempty"`
// SurveyCompletedDate - Completion datetime of the survey in ISO 8601 format
SurveyCompletedDate *time.Time `json:"surveyCompletedDate,omitempty"`
// SurveyFormContextId - Unique identifier for the survey form, regardless of version
SurveyFormContextId *string `json:"surveyFormContextId,omitempty"`
// SurveyFormId - ID of the survey form used
SurveyFormId *string `json:"surveyFormId,omitempty"`
// SurveyFormName - Name of the survey form used
SurveyFormName *string `json:"surveyFormName,omitempty"`
// SurveyId - ID of the survey
SurveyId *string `json:"surveyId,omitempty"`
// SurveyPromoterScore - Score of the survey used with NPS
SurveyPromoterScore *int `json:"surveyPromoterScore,omitempty"`
// SurveyStatus - The status of the survey
SurveyStatus *string `json:"surveyStatus,omitempty"`
// UserId - ID of the agent the survey was performed against
UserId *string `json:"userId,omitempty"`
// OSurveyTotalScore
OSurveyTotalScore *int `json:"oSurveyTotalScore,omitempty"`
}
func (o *Analyticssurvey) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Analyticssurvey
EventTime := new(string)
if o.EventTime != nil {
*EventTime = timeutil.Strftime(o.EventTime, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
EventTime = nil
}
SurveyCompletedDate := new(string)
if o.SurveyCompletedDate != nil {
*SurveyCompletedDate = timeutil.Strftime(o.SurveyCompletedDate, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
SurveyCompletedDate = nil
}
return json.Marshal(&struct {
EventTime *string `json:"eventTime,omitempty"`
QueueId *string `json:"queueId,omitempty"`
SurveyCompletedDate *string `json:"surveyCompletedDate,omitempty"`
SurveyFormContextId *string `json:"surveyFormContextId,omitempty"`
SurveyFormId *string `json:"surveyFormId,omitempty"`
SurveyFormName *string `json:"surveyFormName,omitempty"`
SurveyId *string `json:"surveyId,omitempty"`
SurveyPromoterScore *int `json:"surveyPromoterScore,omitempty"`
SurveyStatus *string `json:"surveyStatus,omitempty"`
UserId *string `json:"userId,omitempty"`
OSurveyTotalScore *int `json:"oSurveyTotalScore,omitempty"`
*Alias
}{
EventTime: EventTime,
QueueId: o.QueueId,
SurveyCompletedDate: SurveyCompletedDate,
SurveyFormContextId: o.SurveyFormContextId,
SurveyFormId: o.SurveyFormId,
SurveyFormName: o.SurveyFormName,
SurveyId: o.SurveyId,
SurveyPromoterScore: o.SurveyPromoterScore,
SurveyStatus: o.SurveyStatus,
UserId: o.UserId,
OSurveyTotalScore: o.OSurveyTotalScore,
Alias: (*Alias)(o),
})
}
func (o *Analyticssurvey) UnmarshalJSON(b []byte) error {
var AnalyticssurveyMap map[string]interface{}
err := json.Unmarshal(b, &AnalyticssurveyMap)
if err != nil {
return err
}
if eventTimeString, ok := AnalyticssurveyMap["eventTime"].(string); ok {
EventTime, _ := time.Parse("2006-01-02T15:04:05.999999Z", eventTimeString)
o.EventTime = &EventTime
}
if QueueId, ok := AnalyticssurveyMap["queueId"].(string); ok {
o.QueueId = &QueueId
}
if surveyCompletedDateString, ok := AnalyticssurveyMap["surveyCompletedDate"].(string); ok {
SurveyCompletedDate, _ := time.Parse("2006-01-02T15:04:05.999999Z", surveyCompletedDateString)
o.SurveyCompletedDate = &SurveyCompletedDate
}
if SurveyFormContextId, ok := AnalyticssurveyMap["surveyFormContextId"].(string); ok {
o.SurveyFormContextId = &SurveyFormContextId
}
if SurveyFormId, ok := AnalyticssurveyMap["surveyFormId"].(string); ok {
o.SurveyFormId = &SurveyFormId
}
if SurveyFormName, ok := AnalyticssurveyMap["surveyFormName"].(string); ok {
o.SurveyFormName = &SurveyFormName
}
if SurveyId, ok := AnalyticssurveyMap["surveyId"].(string); ok {
o.SurveyId = &SurveyId
}
if SurveyPromoterScore, ok := AnalyticssurveyMap["surveyPromoterScore"].(float64); ok {
SurveyPromoterScoreInt := int(SurveyPromoterScore)
o.SurveyPromoterScore = &SurveyPromoterScoreInt
}
if SurveyStatus, ok := AnalyticssurveyMap["surveyStatus"].(string); ok {
o.SurveyStatus = &SurveyStatus
}
if UserId, ok := AnalyticssurveyMap["userId"].(string); ok {
o.UserId = &UserId
}
if OSurveyTotalScore, ok := AnalyticssurveyMap["oSurveyTotalScore"].(float64); ok {
OSurveyTotalScoreInt := int(OSurveyTotalScore)
o.OSurveyTotalScore = &OSurveyTotalScoreInt
}
return nil
}
// String returns a JSON representation of the model
func (o *Analyticssurvey) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}