-
Notifications
You must be signed in to change notification settings - Fork 13
/
gdprsubject.go
165 lines (110 loc) · 4.02 KB
/
gdprsubject.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
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Gdprsubject
type Gdprsubject struct {
// Name
Name *string `json:"name,omitempty"`
// UserId
UserId *string `json:"userId,omitempty"`
// ExternalContactId
ExternalContactId *string `json:"externalContactId,omitempty"`
// DialerContactId
DialerContactId *Dialercontactid `json:"dialerContactId,omitempty"`
// JourneyCustomer
JourneyCustomer *Gdprjourneycustomer `json:"journeyCustomer,omitempty"`
// SocialHandle
SocialHandle *Socialhandle `json:"socialHandle,omitempty"`
// ExternalId
ExternalId *string `json:"externalId,omitempty"`
// Addresses
Addresses *[]string `json:"addresses,omitempty"`
// PhoneNumbers
PhoneNumbers *[]string `json:"phoneNumbers,omitempty"`
// EmailAddresses
EmailAddresses *[]string `json:"emailAddresses,omitempty"`
}
func (o *Gdprsubject) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Gdprsubject
return json.Marshal(&struct {
Name *string `json:"name,omitempty"`
UserId *string `json:"userId,omitempty"`
ExternalContactId *string `json:"externalContactId,omitempty"`
DialerContactId *Dialercontactid `json:"dialerContactId,omitempty"`
JourneyCustomer *Gdprjourneycustomer `json:"journeyCustomer,omitempty"`
SocialHandle *Socialhandle `json:"socialHandle,omitempty"`
ExternalId *string `json:"externalId,omitempty"`
Addresses *[]string `json:"addresses,omitempty"`
PhoneNumbers *[]string `json:"phoneNumbers,omitempty"`
EmailAddresses *[]string `json:"emailAddresses,omitempty"`
*Alias
}{
Name: o.Name,
UserId: o.UserId,
ExternalContactId: o.ExternalContactId,
DialerContactId: o.DialerContactId,
JourneyCustomer: o.JourneyCustomer,
SocialHandle: o.SocialHandle,
ExternalId: o.ExternalId,
Addresses: o.Addresses,
PhoneNumbers: o.PhoneNumbers,
EmailAddresses: o.EmailAddresses,
Alias: (*Alias)(o),
})
}
func (o *Gdprsubject) UnmarshalJSON(b []byte) error {
var GdprsubjectMap map[string]interface{}
err := json.Unmarshal(b, &GdprsubjectMap)
if err != nil {
return err
}
if Name, ok := GdprsubjectMap["name"].(string); ok {
o.Name = &Name
}
if UserId, ok := GdprsubjectMap["userId"].(string); ok {
o.UserId = &UserId
}
if ExternalContactId, ok := GdprsubjectMap["externalContactId"].(string); ok {
o.ExternalContactId = &ExternalContactId
}
if DialerContactId, ok := GdprsubjectMap["dialerContactId"].(map[string]interface{}); ok {
DialerContactIdString, _ := json.Marshal(DialerContactId)
json.Unmarshal(DialerContactIdString, &o.DialerContactId)
}
if JourneyCustomer, ok := GdprsubjectMap["journeyCustomer"].(map[string]interface{}); ok {
JourneyCustomerString, _ := json.Marshal(JourneyCustomer)
json.Unmarshal(JourneyCustomerString, &o.JourneyCustomer)
}
if SocialHandle, ok := GdprsubjectMap["socialHandle"].(map[string]interface{}); ok {
SocialHandleString, _ := json.Marshal(SocialHandle)
json.Unmarshal(SocialHandleString, &o.SocialHandle)
}
if ExternalId, ok := GdprsubjectMap["externalId"].(string); ok {
o.ExternalId = &ExternalId
}
if Addresses, ok := GdprsubjectMap["addresses"].([]interface{}); ok {
AddressesString, _ := json.Marshal(Addresses)
json.Unmarshal(AddressesString, &o.Addresses)
}
if PhoneNumbers, ok := GdprsubjectMap["phoneNumbers"].([]interface{}); ok {
PhoneNumbersString, _ := json.Marshal(PhoneNumbers)
json.Unmarshal(PhoneNumbersString, &o.PhoneNumbers)
}
if EmailAddresses, ok := GdprsubjectMap["emailAddresses"].([]interface{}); ok {
EmailAddressesString, _ := json.Marshal(EmailAddresses)
json.Unmarshal(EmailAddressesString, &o.EmailAddresses)
}
return nil
}
// String returns a JSON representation of the model
func (o *Gdprsubject) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}