-
Notifications
You must be signed in to change notification settings - Fork 1
/
offer_signup_page.go
82 lines (75 loc) · 2.67 KB
/
offer_signup_page.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
package models
import (
"encoding/json"
)
// OfferSignupPage represents a OfferSignupPage struct.
type OfferSignupPage struct {
Id *int `json:"id,omitempty"`
Nickname *string `json:"nickname,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ReturnUrl *string `json:"return_url,omitempty"`
ReturnParams *string `json:"return_params,omitempty"`
Url *string `json:"url,omitempty"`
AdditionalProperties map[string]any `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OfferSignupPage.
// It customizes the JSON marshaling process for OfferSignupPage objects.
func (o OfferSignupPage) MarshalJSON() (
[]byte,
error) {
return json.Marshal(o.toMap())
}
// toMap converts the OfferSignupPage object to a map representation for JSON marshaling.
func (o OfferSignupPage) toMap() map[string]any {
structMap := make(map[string]any)
MapAdditionalProperties(structMap, o.AdditionalProperties)
if o.Id != nil {
structMap["id"] = o.Id
}
if o.Nickname != nil {
structMap["nickname"] = o.Nickname
}
if o.Enabled != nil {
structMap["enabled"] = o.Enabled
}
if o.ReturnUrl != nil {
structMap["return_url"] = o.ReturnUrl
}
if o.ReturnParams != nil {
structMap["return_params"] = o.ReturnParams
}
if o.Url != nil {
structMap["url"] = o.Url
}
return structMap
}
// UnmarshalJSON implements the json.Unmarshaler interface for OfferSignupPage.
// It customizes the JSON unmarshaling process for OfferSignupPage objects.
func (o *OfferSignupPage) UnmarshalJSON(input []byte) error {
var temp offerSignupPage
err := json.Unmarshal(input, &temp)
if err != nil {
return err
}
additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "nickname", "enabled", "return_url", "return_params", "url")
if err != nil {
return err
}
o.AdditionalProperties = additionalProperties
o.Id = temp.Id
o.Nickname = temp.Nickname
o.Enabled = temp.Enabled
o.ReturnUrl = temp.ReturnUrl
o.ReturnParams = temp.ReturnParams
o.Url = temp.Url
return nil
}
// offerSignupPage is a temporary struct used for validating the fields of OfferSignupPage.
type offerSignupPage struct {
Id *int `json:"id,omitempty"`
Nickname *string `json:"nickname,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ReturnUrl *string `json:"return_url,omitempty"`
ReturnParams *string `json:"return_params,omitempty"`
Url *string `json:"url,omitempty"`
}