forked from MyPureCloud/platform-client-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
learningmodulesummary.go
91 lines (66 loc) · 2.37 KB
/
learningmodulesummary.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Learningmodulesummary - Learning module summary data
type Learningmodulesummary struct {
// AssignedCount - The total number of assignments assigned for a learning module
AssignedCount *int `json:"assignedCount"`
// CompletedCount - The number of assignments completed for a learning module
CompletedCount *int `json:"completedCount"`
// PassedCount - The number of assignments passed for a learning module
PassedCount *int `json:"passedCount"`
// CompletedSum - The sum of assignment scores for a learning module
CompletedSum *float32 `json:"completedSum"`
}
func (o *Learningmodulesummary) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Learningmodulesummary
return json.Marshal(&struct {
AssignedCount *int `json:"assignedCount"`
CompletedCount *int `json:"completedCount"`
PassedCount *int `json:"passedCount"`
CompletedSum *float32 `json:"completedSum"`
*Alias
}{
AssignedCount: o.AssignedCount,
CompletedCount: o.CompletedCount,
PassedCount: o.PassedCount,
CompletedSum: o.CompletedSum,
Alias: (*Alias)(o),
})
}
func (o *Learningmodulesummary) UnmarshalJSON(b []byte) error {
var LearningmodulesummaryMap map[string]interface{}
err := json.Unmarshal(b, &LearningmodulesummaryMap)
if err != nil {
return err
}
if AssignedCount, ok := LearningmodulesummaryMap["assignedCount"].(float64); ok {
AssignedCountInt := int(AssignedCount)
o.AssignedCount = &AssignedCountInt
}
if CompletedCount, ok := LearningmodulesummaryMap["completedCount"].(float64); ok {
CompletedCountInt := int(CompletedCount)
o.CompletedCount = &CompletedCountInt
}
if PassedCount, ok := LearningmodulesummaryMap["passedCount"].(float64); ok {
PassedCountInt := int(PassedCount)
o.PassedCount = &PassedCountInt
}
if CompletedSum, ok := LearningmodulesummaryMap["completedSum"].(float64); ok {
CompletedSumFloat32 := float32(CompletedSum)
o.CompletedSum = &CompletedSumFloat32
}
return nil
}
// String returns a JSON representation of the model
func (o *Learningmodulesummary) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}