-
Notifications
You must be signed in to change notification settings - Fork 14
/
lists.go
215 lines (184 loc) · 5.79 KB
/
lists.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/trycourier/courier-go/v3/core"
)
type AddSubscribersToList struct {
Recipients []*PutSubscriptionsRecipient `json:"recipients,omitempty" url:"recipients,omitempty"`
}
type GetSubscriptionForListRequest struct {
// A unique identifier that allows for fetching the next set of list subscriptions
Cursor *string `json:"-" url:"cursor,omitempty"`
}
type GetAllListsRequest struct {
// A unique identifier that allows for fetching the next page of lists.
Cursor *string `json:"-" url:"cursor,omitempty"`
// "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match."
Pattern *string `json:"-" url:"pattern,omitempty"`
}
type SubscribeUserToListRequest struct {
Preferences *RecipientPreferences `json:"preferences,omitempty" url:"preferences,omitempty"`
}
type RecipientPreferences struct {
Categories *NotificationPreferences `json:"categories,omitempty" url:"categories,omitempty"`
Notifications *NotificationPreferences `json:"notifications,omitempty" url:"notifications,omitempty"`
_rawJSON json.RawMessage
}
func (r *RecipientPreferences) UnmarshalJSON(data []byte) error {
type unmarshaler RecipientPreferences
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*r = RecipientPreferences(value)
r._rawJSON = json.RawMessage(data)
return nil
}
func (r *RecipientPreferences) String() string {
if len(r._rawJSON) > 0 {
if value, err := core.StringifyJSON(r._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(r); err == nil {
return value
}
return fmt.Sprintf("%#v", r)
}
type List struct {
Id string `json:"id" url:"id"`
Name string `json:"name" url:"name"`
Created *int `json:"created,omitempty" url:"created,omitempty"`
Updated *int `json:"updated,omitempty" url:"updated,omitempty"`
_rawJSON json.RawMessage
}
func (l *List) UnmarshalJSON(data []byte) error {
type unmarshaler List
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = List(value)
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *List) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type ListGetAllResponse struct {
Paging *Paging `json:"paging,omitempty" url:"paging,omitempty"`
Items []*List `json:"items,omitempty" url:"items,omitempty"`
_rawJSON json.RawMessage
}
func (l *ListGetAllResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListGetAllResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListGetAllResponse(value)
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *ListGetAllResponse) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type ListGetSubscriptionsResponse struct {
Paging *Paging `json:"paging,omitempty" url:"paging,omitempty"`
Items []*ListSubscriptionRecipient `json:"items,omitempty" url:"items,omitempty"`
_rawJSON json.RawMessage
}
func (l *ListGetSubscriptionsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListGetSubscriptionsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListGetSubscriptionsResponse(value)
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *ListGetSubscriptionsResponse) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type ListPutParams struct {
Name string `json:"name" url:"name"`
Preferences *RecipientPreferences `json:"preferences,omitempty" url:"preferences,omitempty"`
_rawJSON json.RawMessage
}
func (l *ListPutParams) UnmarshalJSON(data []byte) error {
type unmarshaler ListPutParams
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListPutParams(value)
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *ListPutParams) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
type PutSubscriptionsRecipient struct {
RecipientId string `json:"recipientId" url:"recipientId"`
Preferences *RecipientPreferences `json:"preferences,omitempty" url:"preferences,omitempty"`
_rawJSON json.RawMessage
}
func (p *PutSubscriptionsRecipient) UnmarshalJSON(data []byte) error {
type unmarshaler PutSubscriptionsRecipient
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*p = PutSubscriptionsRecipient(value)
p._rawJSON = json.RawMessage(data)
return nil
}
func (p *PutSubscriptionsRecipient) String() string {
if len(p._rawJSON) > 0 {
if value, err := core.StringifyJSON(p._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(p); err == nil {
return value
}
return fmt.Sprintf("%#v", p)
}
type SubscribeUsersToListRequest struct {
Recipients []*PutSubscriptionsRecipient `json:"recipients,omitempty" url:"recipients,omitempty"`
}