-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhooks.go
More file actions
222 lines (195 loc) · 4.71 KB
/
webhooks.go
File metadata and controls
222 lines (195 loc) · 4.71 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// This file was auto-generated by Fern from our API Definition.
package livesession
import (
json "encoding/json"
fmt "fmt"
internal "go.livesession.io/livesession-go/internal"
)
type WebhookCreate struct {
// URL for the webhook
Url string `json:"url" url:"-"`
// Website ID
WebsiteId string `json:"website_id" url:"-"`
// API version (e.g., v1.0)
Version string `json:"version" url:"-"`
}
type Webhook struct {
// Webhook ID
WebhookId *string `json:"webhook_id,omitempty" url:"webhook_id,omitempty"`
// URL for the webhook
Url *string `json:"url,omitempty" url:"url,omitempty"`
// Website name
Website *string `json:"website,omitempty" url:"website,omitempty"`
// Website ID
WebsiteId *string `json:"website_id,omitempty" url:"website_id,omitempty"`
// API version
Version *string `json:"version,omitempty" url:"version,omitempty"`
// Webhook enabled status
Enabled *bool `json:"enabled,omitempty" url:"enabled,omitempty"`
// Unix timestamp for creation date
CreatedDate *int64 `json:"created_date,omitempty" url:"created_date,omitempty"`
// Creator of the webhook
CreatedBy *string `json:"created_by,omitempty" url:"created_by,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (w *Webhook) GetWebhookId() *string {
if w == nil {
return nil
}
return w.WebhookId
}
func (w *Webhook) GetUrl() *string {
if w == nil {
return nil
}
return w.Url
}
func (w *Webhook) GetWebsite() *string {
if w == nil {
return nil
}
return w.Website
}
func (w *Webhook) GetWebsiteId() *string {
if w == nil {
return nil
}
return w.WebsiteId
}
func (w *Webhook) GetVersion() *string {
if w == nil {
return nil
}
return w.Version
}
func (w *Webhook) GetEnabled() *bool {
if w == nil {
return nil
}
return w.Enabled
}
func (w *Webhook) GetCreatedDate() *int64 {
if w == nil {
return nil
}
return w.CreatedDate
}
func (w *Webhook) GetCreatedBy() *string {
if w == nil {
return nil
}
return w.CreatedBy
}
func (w *Webhook) GetExtraProperties() map[string]interface{} {
return w.extraProperties
}
func (w *Webhook) UnmarshalJSON(data []byte) error {
type unmarshaler Webhook
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*w = Webhook(value)
extraProperties, err := internal.ExtractExtraProperties(data, *w)
if err != nil {
return err
}
w.extraProperties = extraProperties
w.rawJSON = json.RawMessage(data)
return nil
}
func (w *Webhook) String() string {
if len(w.rawJSON) > 0 {
if value, err := internal.StringifyJSON(w.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(w); err == nil {
return value
}
return fmt.Sprintf("%#v", w)
}
type WebhookDeleted struct {
// Webhook ID
WebhookId *string `json:"webhook_id,omitempty" url:"webhook_id,omitempty"`
// Indicates if the webhook was deleted
Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (w *WebhookDeleted) GetWebhookId() *string {
if w == nil {
return nil
}
return w.WebhookId
}
func (w *WebhookDeleted) GetDeleted() *bool {
if w == nil {
return nil
}
return w.Deleted
}
func (w *WebhookDeleted) GetExtraProperties() map[string]interface{} {
return w.extraProperties
}
func (w *WebhookDeleted) UnmarshalJSON(data []byte) error {
type unmarshaler WebhookDeleted
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*w = WebhookDeleted(value)
extraProperties, err := internal.ExtractExtraProperties(data, *w)
if err != nil {
return err
}
w.extraProperties = extraProperties
w.rawJSON = json.RawMessage(data)
return nil
}
func (w *WebhookDeleted) String() string {
if len(w.rawJSON) > 0 {
if value, err := internal.StringifyJSON(w.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(w); err == nil {
return value
}
return fmt.Sprintf("%#v", w)
}
type WebhookUpdate struct {
// API version
// URL for the webhook
Url string `json:"url" url:"-"`
// Website ID
WebsiteId string `json:"website_id" url:"-"`
// API version (e.g., v1.0)
WebhookUpdateVersion string `json:"version" url:"-"`
version string
}
func (w *WebhookUpdate) Version() string {
return w.version
}
func (w *WebhookUpdate) UnmarshalJSON(data []byte) error {
type unmarshaler WebhookUpdate
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*w = WebhookUpdate(body)
w.version = "v1.0"
return nil
}
func (w *WebhookUpdate) MarshalJSON() ([]byte, error) {
type embed WebhookUpdate
var marshaler = struct {
embed
Version string `json:"version"`
}{
embed: embed(*w),
Version: "v1.0",
}
return json.Marshal(marshaler)
}