-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
market.go
271 lines (235 loc) · 8.53 KB
/
market.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
package api // import "github.com/SevereCloud/vksdk/5.92/api"
import (
"github.com/SevereCloud/vksdk/5.92/object"
)
// MarketAddResponse struct
type MarketAddResponse struct {
MarketItemID int `json:"market_item_id"` // Item ID
}
// MarketAdd adds a new item to the market.
//
// https://vk.com/dev/market.add
func (vk *VK) MarketAdd(params map[string]string) (response MarketAddResponse, vkErr Error) {
vk.RequestUnmarshal("market.add", params, &response, &vkErr)
return
}
// MarketAddAlbumResponse struct
type MarketAddAlbumResponse struct {
MarketAlbumID int `json:"market_album_id"` // Album ID
}
// MarketAddAlbum creates new collection of items
//
// https://vk.com/dev/market.addAlbum
func (vk *VK) MarketAddAlbum(params map[string]string) (response MarketAddAlbumResponse, vkErr Error) {
vk.RequestUnmarshal("market.addAlbum", params, &response, &vkErr)
return
}
// MarketAddToAlbum adds an item to one or multiple collections.
//
// https://vk.com/dev/market.addToAlbum
func (vk *VK) MarketAddToAlbum(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.addToAlbum", params, &response, &vkErr)
return
}
// MarketCreateComment creates a new comment for an item.
//
// https://vk.com/dev/market.createComment
func (vk *VK) MarketCreateComment(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.createComment", params, &response, &vkErr)
return
}
// MarketDelete deletes an item.
//
// https://vk.com/dev/market.delete
func (vk *VK) MarketDelete(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.delete", params, &response, &vkErr)
return
}
// MarketDeleteAlbum deletes a collection of items.
//
// https://vk.com/dev/market.deleteAlbum
func (vk *VK) MarketDeleteAlbum(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.deleteAlbum", params, &response, &vkErr)
return
}
// MarketDeleteComment deletes an item's comment
//
// https://vk.com/dev/market.deleteComment
func (vk *VK) MarketDeleteComment(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.deleteComment", params, &response, &vkErr)
return
}
// MarketEdit edits an item.
//
// https://vk.com/dev/market.edit
func (vk *VK) MarketEdit(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.edit", params, &response, &vkErr)
return
}
// MarketEditAlbum edits a collection of items
//
// https://vk.com/dev/market.editAlbum
func (vk *VK) MarketEditAlbum(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.editAlbum", params, &response, &vkErr)
return
}
// MarketEditComment changes item comment's text
//
// https://vk.com/dev/market.editComment
func (vk *VK) MarketEditComment(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.editComment", params, &response, &vkErr)
return
}
// MarketGetResponse struct
type MarketGetResponse struct {
Count int `json:"count"`
Items []object.MarketMarketItem `json:"items"`
}
// MarketGet returns items list for a community.
//
// https://vk.com/dev/market.get
func (vk *VK) MarketGet(params map[string]string) (response MarketGetResponse, vkErr Error) {
vk.RequestUnmarshal("market.get", params, &response, &vkErr)
return
}
// MarketGetAlbumByIDResponse struct
type MarketGetAlbumByIDResponse struct {
Count int `json:"count"`
Items []object.MarketMarketAlbum `json:"items"`
}
// MarketGetAlbumByID returns items album's data
//
// https://vk.com/dev/market.getAlbumById
func (vk *VK) MarketGetAlbumByID(params map[string]string) (response MarketGetAlbumByIDResponse, vkErr Error) {
vk.RequestUnmarshal("market.getAlbumById", params, &response, &vkErr)
return
}
// MarketGetAlbumsResponse struct
type MarketGetAlbumsResponse struct {
Count int `json:"count"`
Items []object.MarketMarketAlbum `json:"items"`
}
// MarketGetAlbums returns community's collections list.
//
// https://vk.com/dev/market.getAlbums
func (vk *VK) MarketGetAlbums(params map[string]string) (response MarketGetAlbumsResponse, vkErr Error) {
vk.RequestUnmarshal("market.getAlbums", params, &response, &vkErr)
return
}
// MarketGetByIDResponse struct
type MarketGetByIDResponse struct {
Count int `json:"count"`
Items []object.MarketMarketItem `json:"items"`
}
// MarketGetByID returns information about market items by their iDs.
//
// https://vk.com/dev/market.getById
func (vk *VK) MarketGetByID(params map[string]string) (response MarketGetByIDResponse, vkErr Error) {
vk.RequestUnmarshal("market.getById", params, &response, &vkErr)
return
}
// MarketGetCategoriesResponse struct
type MarketGetCategoriesResponse struct {
Count int `json:"count"`
Items []object.MarketMarketCategory `json:"items"`
}
// MarketGetCategories returns a list of market categories.
//
// https://vk.com/dev/market.getCategories
func (vk *VK) MarketGetCategories(params map[string]string) (response MarketGetCategoriesResponse, vkErr Error) {
vk.RequestUnmarshal("market.getCategories", params, &response, &vkErr)
return
}
// MarketGetCommentsResponse struct
type MarketGetCommentsResponse struct {
Count int `json:"count"`
Items []object.WallWallComment `json:"items"`
}
// MarketGetComments returns comments list for an item.
//
// extended=0
//
// https://vk.com/dev/market.getComments
func (vk *VK) MarketGetComments(params map[string]string) (response MarketGetCommentsResponse, vkErr Error) {
params["extended"] = "0"
vk.RequestUnmarshal("market.getComments", params, &response, &vkErr)
return
}
// MarketGetCommentsExtendedResponse struct
type MarketGetCommentsExtendedResponse struct {
Count int `json:"count"`
Items []object.WallWallComment `json:"items"`
Profiles []object.UsersUser `json:"profiles"`
Groups []object.GroupsGroup `json:"groups"`
}
// MarketGetCommentsExtended returns comments list for an item.
//
// extended=1
//
// https://vk.com/dev/market.getComments
func (vk *VK) MarketGetCommentsExtended(params map[string]string) (response MarketGetCommentsExtendedResponse, vkErr Error) {
params["extended"] = "1"
vk.RequestUnmarshal("market.getComments", params, &response, &vkErr)
return
}
// MarketRemoveFromAlbum removes an item from one or multiple collections.
//
// https://vk.com/dev/market.removeFromAlbum
func (vk *VK) MarketRemoveFromAlbum(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.removeFromAlbum", params, &response, &vkErr)
return
}
// MarketReorderAlbums reorders the collections list.
//
// https://vk.com/dev/market.reorderAlbums
func (vk *VK) MarketReorderAlbums(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.reorderAlbums", params, &response, &vkErr)
return
}
// MarketReorderItems changes item place in a collection.
//
// https://vk.com/dev/market.reorderItems
func (vk *VK) MarketReorderItems(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.reorderItems", params, &response, &vkErr)
return
}
// MarketReport sends a complaint to the item.
//
// https://vk.com/dev/market.report
func (vk *VK) MarketReport(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.report", params, &response, &vkErr)
return
}
// MarketReportComment sends a complaint to the item's comment.
//
// https://vk.com/dev/market.reportComment
func (vk *VK) MarketReportComment(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.reportComment", params, &response, &vkErr)
return
}
// MarketRestore restores recently deleted item
//
// https://vk.com/dev/market.restore
func (vk *VK) MarketRestore(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.restore", params, &response, &vkErr)
return
}
// MarketRestoreComment restores a recently deleted comment
//
// https://vk.com/dev/market.restoreComment
func (vk *VK) MarketRestoreComment(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("market.restoreComment", params, &response, &vkErr)
return
}
// MarketSearchResponse struct
type MarketSearchResponse struct {
Count int `json:"count"`
Items []object.MarketMarketItem `json:"items"`
}
// MarketSearch searches market items in a community's catalog
//
// https://vk.com/dev/market.search
func (vk *VK) MarketSearch(params map[string]string) (response MarketSearchResponse, vkErr Error) {
vk.RequestUnmarshal("market.search", params, &response, &vkErr)
return
}