-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
secure.go
311 lines (265 loc) · 8.3 KB
/
secure.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
package params // import "github.com/SevereCloud/vksdk/v2/api/params"
import (
"github.com/SevereCloud/vksdk/v2/api"
)
// SecureAddAppEventBuilder builder.
//
// Adds user activity information to an application.
//
// https://vk.com/dev/secure.addAppEvent
type SecureAddAppEventBuilder struct {
api.Params
}
// NewSecureAddAppEventBuilder func.
func NewSecureAddAppEventBuilder() *SecureAddAppEventBuilder {
return &SecureAddAppEventBuilder{api.Params{}}
}
// UserID ID of a user to save the data.
func (b *SecureAddAppEventBuilder) UserID(v int) *SecureAddAppEventBuilder {
b.Params["user_id"] = v
return b
}
// ActivityID there are 2 default activities:
//
// * 1 – level. Works similar to;
//
// * 2 – points, saves points amount.
//
// Any other value is for saving completed missions.
func (b *SecureAddAppEventBuilder) ActivityID(v int) *SecureAddAppEventBuilder {
b.Params["activity_id"] = v
return b
}
// Value depends on activity_id:
//
// * 1 – number, current level number.
//
// * 2 – number, current user's points amount.
//
// Any other value is ignored.
func (b *SecureAddAppEventBuilder) Value(v int) *SecureAddAppEventBuilder {
b.Params["value"] = v
return b
}
// SecureCheckTokenBuilder builder.
//
// Checks the user authentication in 'IFrame' and 'Flash' apps using the 'access_token' parameter.
//
// https://vk.com/dev/secure.checkToken
type SecureCheckTokenBuilder struct {
api.Params
}
// NewSecureCheckTokenBuilder func.
func NewSecureCheckTokenBuilder() *SecureCheckTokenBuilder {
return &SecureCheckTokenBuilder{api.Params{}}
}
// Token client 'access_token'.
func (b *SecureCheckTokenBuilder) Token(v string) *SecureCheckTokenBuilder {
b.Params["token"] = v
return b
}
// IP user 'ip address'.
//
// Note that user may access using the 'ipv6' address, in this case it is required to transmit the 'ipv6' address.
// If not transmitted, the address will not be checked.
func (b *SecureCheckTokenBuilder) IP(v string) *SecureCheckTokenBuilder {
b.Params["ip"] = v
return b
}
// SecureGetSMSHistoryBuilder builder.
//
// Shows a list of SMS notifications sent by the application using
// [vk.com/dev/secure.sendSMSNotification|secure.sendSMSNotification] method.
//
// https://vk.com/dev/secure.getSMSHistory
type SecureGetSMSHistoryBuilder struct {
api.Params
}
// NewSecureGetSMSHistoryBuilder func.
func NewSecureGetSMSHistoryBuilder() *SecureGetSMSHistoryBuilder {
return &SecureGetSMSHistoryBuilder{api.Params{}}
}
// UserID parameter.
func (b *SecureGetSMSHistoryBuilder) UserID(v int) *SecureGetSMSHistoryBuilder {
b.Params["user_id"] = v
return b
}
// DateFrom filter by start date. It is set as UNIX-time.
func (b *SecureGetSMSHistoryBuilder) DateFrom(v int) *SecureGetSMSHistoryBuilder {
b.Params["date_from"] = v
return b
}
// DateTo filter by end date. It is set as UNIX-time.
func (b *SecureGetSMSHistoryBuilder) DateTo(v int) *SecureGetSMSHistoryBuilder {
b.Params["date_to"] = v
return b
}
// Limit number of returned posts. By default — 1000.
func (b *SecureGetSMSHistoryBuilder) Limit(v int) *SecureGetSMSHistoryBuilder {
b.Params["limit"] = v
return b
}
// SecureGetTransactionsHistoryBuilder builder.
//
// Shows history of votes transaction between users and the application.
//
// https://vk.com/dev/secure.getTransactionsHistory
type SecureGetTransactionsHistoryBuilder struct {
api.Params
}
// NewSecureGetTransactionsHistoryBuilder func.
func NewSecureGetTransactionsHistoryBuilder() *SecureGetTransactionsHistoryBuilder {
return &SecureGetTransactionsHistoryBuilder{api.Params{}}
}
// Type parameter.
func (b *SecureGetTransactionsHistoryBuilder) Type(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["type"] = v
return b
}
// UIDFrom parameter.
func (b *SecureGetTransactionsHistoryBuilder) UIDFrom(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["uid_from"] = v
return b
}
// UIDTo parameter.
func (b *SecureGetTransactionsHistoryBuilder) UIDTo(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["uid_to"] = v
return b
}
// DateFrom parameter.
func (b *SecureGetTransactionsHistoryBuilder) DateFrom(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["date_from"] = v
return b
}
// DateTo parameter.
func (b *SecureGetTransactionsHistoryBuilder) DateTo(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["date_to"] = v
return b
}
// Limit parameter.
func (b *SecureGetTransactionsHistoryBuilder) Limit(v int) *SecureGetTransactionsHistoryBuilder {
b.Params["limit"] = v
return b
}
// SecureGetUserLevelBuilder builder.
//
// Returns one of the previously set game levels of one or more users in the application.
//
// https://vk.com/dev/secure.getUserLevel
type SecureGetUserLevelBuilder struct {
api.Params
}
// NewSecureGetUserLevelBuilder func.
func NewSecureGetUserLevelBuilder() *SecureGetUserLevelBuilder {
return &SecureGetUserLevelBuilder{api.Params{}}
}
// UserIDs parameter.
func (b *SecureGetUserLevelBuilder) UserIDs(v []int) *SecureGetUserLevelBuilder {
b.Params["user_ids"] = v
return b
}
// SecureGiveEventStickerBuilder builder.
//
// Opens the game achievement and gives the user a sticker.
//
// https://vk.com/dev/secure.giveEventSticker
type SecureGiveEventStickerBuilder struct {
api.Params
}
// NewSecureGiveEventStickerBuilder func.
func NewSecureGiveEventStickerBuilder() *SecureGiveEventStickerBuilder {
return &SecureGiveEventStickerBuilder{api.Params{}}
}
// UserIDs parameter.
func (b *SecureGiveEventStickerBuilder) UserIDs(v []int) *SecureGiveEventStickerBuilder {
b.Params["user_ids"] = v
return b
}
// AchievementID parameter.
func (b *SecureGiveEventStickerBuilder) AchievementID(v int) *SecureGiveEventStickerBuilder {
b.Params["achievement_id"] = v
return b
}
// SecureSendNotificationBuilder builder.
//
// Sends notification to the user.
//
// https://vk.com/dev/secure.sendNotification
type SecureSendNotificationBuilder struct {
api.Params
}
// NewSecureSendNotificationBuilder func.
func NewSecureSendNotificationBuilder() *SecureSendNotificationBuilder {
return &SecureSendNotificationBuilder{api.Params{}}
}
// UserIDs parameter.
func (b *SecureSendNotificationBuilder) UserIDs(v []int) *SecureSendNotificationBuilder {
b.Params["user_ids"] = v
return b
}
// UserID parameter.
func (b *SecureSendNotificationBuilder) UserID(v int) *SecureSendNotificationBuilder {
b.Params["user_id"] = v
return b
}
// Message notification text which should be sent in 'UTF-8' encoding ('254' characters maximum).
func (b *SecureSendNotificationBuilder) Message(v string) *SecureSendNotificationBuilder {
b.Params["message"] = v
return b
}
// SecureSendSMSNotificationBuilder builder.
//
// Sends 'SMS' notification to a user's mobile device.
//
// https://vk.com/dev/secure.sendSMSNotification
type SecureSendSMSNotificationBuilder struct {
api.Params
}
// NewSecureSendSMSNotificationBuilder func.
func NewSecureSendSMSNotificationBuilder() *SecureSendSMSNotificationBuilder {
return &SecureSendSMSNotificationBuilder{api.Params{}}
}
// UserID ID of the user to whom SMS notification is sent. The user shall allow the application to send him/her
// notifications (, +1).
func (b *SecureSendSMSNotificationBuilder) UserID(v int) *SecureSendSMSNotificationBuilder {
b.Params["user_id"] = v
return b
}
// Message 'SMS' text to be sent in 'UTF-8' encoding. Only Latin letters and numbers are allowed.
// Maximum size is '160' characters.
func (b *SecureSendSMSNotificationBuilder) Message(v string) *SecureSendSMSNotificationBuilder {
b.Params["message"] = v
return b
}
// SecureSetCounterBuilder builder.
//
// Sets a counter which is shown to the user in bold in the left menu.
//
// https://vk.com/dev/secure.setCounter
type SecureSetCounterBuilder struct {
api.Params
}
// NewSecureSetCounterBuilder func.
func NewSecureSetCounterBuilder() *SecureSetCounterBuilder {
return &SecureSetCounterBuilder{api.Params{}}
}
// Counters parameter.
func (b *SecureSetCounterBuilder) Counters(v []string) *SecureSetCounterBuilder {
b.Params["counters"] = v
return b
}
// UserID parameter.
func (b *SecureSetCounterBuilder) UserID(v int) *SecureSetCounterBuilder {
b.Params["user_id"] = v
return b
}
// Counter counter value.
func (b *SecureSetCounterBuilder) Counter(v int) *SecureSetCounterBuilder {
b.Params["counter"] = v
return b
}
// Increment parameter.
func (b *SecureSetCounterBuilder) Increment(v bool) *SecureSetCounterBuilder {
b.Params["increment"] = v
return b
}