summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/api/market.go
blob: 0bb35687f7ed2a3e613dc74222351448f6d58f1b (plain) (blame)
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
package api // import "github.com/SevereCloud/vksdk/v2/api"

import (
	"github.com/SevereCloud/vksdk/v2/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 Params) (response MarketAddResponse, err error) {
	err = vk.RequestUnmarshal("market.add", &response, params)
	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 Params) (response MarketAddAlbumResponse, err error) {
	err = vk.RequestUnmarshal("market.addAlbum", &response, params)
	return
}

// MarketAddToAlbum adds an item to one or multiple collections.
//
// https://vk.com/dev/market.addToAlbum
func (vk *VK) MarketAddToAlbum(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.addToAlbum", &response, params)
	return
}

// MarketCreateComment creates a new comment for an item.
//
// https://vk.com/dev/market.createComment
func (vk *VK) MarketCreateComment(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.createComment", &response, params)
	return
}

// MarketDelete deletes an item.
//
// https://vk.com/dev/market.delete
func (vk *VK) MarketDelete(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.delete", &response, params)
	return
}

// MarketDeleteAlbum deletes a collection of items.
//
// https://vk.com/dev/market.deleteAlbum
func (vk *VK) MarketDeleteAlbum(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.deleteAlbum", &response, params)
	return
}

// MarketDeleteComment deletes an item's comment.
//
// https://vk.com/dev/market.deleteComment
func (vk *VK) MarketDeleteComment(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.deleteComment", &response, params)
	return
}

// MarketEdit edits an item.
//
// https://vk.com/dev/market.edit
func (vk *VK) MarketEdit(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.edit", &response, params)
	return
}

// MarketEditAlbum edits a collection of items.
//
// https://vk.com/dev/market.editAlbum
func (vk *VK) MarketEditAlbum(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.editAlbum", &response, params)
	return
}

// MarketEditComment changes item comment's text.
//
// https://vk.com/dev/market.editComment
func (vk *VK) MarketEditComment(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.editComment", &response, params)
	return
}

// MarketEditOrder edits an order.
//
// https://vk.com/dev/market.editOrder
func (vk *VK) MarketEditOrder(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.editOrder", &response, params)
	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 Params) (response MarketGetResponse, err error) {
	err = vk.RequestUnmarshal("market.get", &response, params)
	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 Params) (response MarketGetAlbumByIDResponse, err error) {
	err = vk.RequestUnmarshal("market.getAlbumById", &response, params)
	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 Params) (response MarketGetAlbumsResponse, err error) {
	err = vk.RequestUnmarshal("market.getAlbums", &response, params)
	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 Params) (response MarketGetByIDResponse, err error) {
	err = vk.RequestUnmarshal("market.getById", &response, params)
	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 Params) (response MarketGetCategoriesResponse, err error) {
	err = vk.RequestUnmarshal("market.getCategories", &response, params)
	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 Params) (response MarketGetCommentsResponse, err error) {
	err = vk.RequestUnmarshal("market.getComments", &response, params, Params{"extended": false})

	return
}

// MarketGetCommentsExtendedResponse struct.
type MarketGetCommentsExtendedResponse struct {
	Count int                      `json:"count"`
	Items []object.WallWallComment `json:"items"`
	object.ExtendedResponse
}

// MarketGetCommentsExtended returns comments list for an item.
//
// 	extended=1
//
// https://vk.com/dev/market.getComments
func (vk *VK) MarketGetCommentsExtended(params Params) (response MarketGetCommentsExtendedResponse, err error) {
	err = vk.RequestUnmarshal("market.getComments", &response, params, Params{"extended": true})

	return
}

// MarketGetGroupOrdersResponse struct.
type MarketGetGroupOrdersResponse struct {
	Count int                  `json:"count"`
	Items []object.MarketOrder `json:"items"`
}

// MarketGetGroupOrders returns community's orders list.
//
// https://vk.com/dev/market.getGroupOrders
func (vk *VK) MarketGetGroupOrders(params Params) (response MarketGetGroupOrdersResponse, err error) {
	err = vk.RequestUnmarshal("market.getGroupOrders", &response, params)
	return
}

// MarketGetOrderByIDResponse struct.
type MarketGetOrderByIDResponse struct {
	Order object.MarketOrder `json:"order"`
}

// MarketGetOrderByID returns order by id.
//
// https://vk.com/dev/market.getOrderById
func (vk *VK) MarketGetOrderByID(params Params) (response MarketGetOrderByIDResponse, err error) {
	err = vk.RequestUnmarshal("market.getOrderById", &response, params)
	return
}

// MarketGetOrderItemsResponse struct.
type MarketGetOrderItemsResponse struct {
	Count int                      `json:"count"`
	Items []object.MarketOrderItem `json:"items"`
}

// MarketGetOrderItems returns items of an order.
//
// https://vk.com/dev/market.getOrderItems
func (vk *VK) MarketGetOrderItems(params Params) (response MarketGetOrderItemsResponse, err error) {
	err = vk.RequestUnmarshal("market.getOrderItems", &response, params)
	return
}

// MarketRemoveFromAlbum removes an item from one or multiple collections.
//
// https://vk.com/dev/market.removeFromAlbum
func (vk *VK) MarketRemoveFromAlbum(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.removeFromAlbum", &response, params)
	return
}

// MarketReorderAlbums reorders the collections list.
//
// https://vk.com/dev/market.reorderAlbums
func (vk *VK) MarketReorderAlbums(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.reorderAlbums", &response, params)
	return
}

// MarketReorderItems changes item place in a collection.
//
// https://vk.com/dev/market.reorderItems
func (vk *VK) MarketReorderItems(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.reorderItems", &response, params)
	return
}

// MarketReport sends a complaint to the item.
//
// https://vk.com/dev/market.report
func (vk *VK) MarketReport(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.report", &response, params)
	return
}

// MarketReportComment sends a complaint to the item's comment.
//
// https://vk.com/dev/market.reportComment
func (vk *VK) MarketReportComment(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.reportComment", &response, params)
	return
}

// MarketRestore restores recently deleted item.
//
// https://vk.com/dev/market.restore
func (vk *VK) MarketRestore(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.restore", &response, params)
	return
}

// MarketRestoreComment restores a recently deleted comment.
//
// https://vk.com/dev/market.restoreComment
func (vk *VK) MarketRestoreComment(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("market.restoreComment", &response, params)
	return
}

// MarketSearchResponse struct.
type MarketSearchResponse struct {
	Count    int                       `json:"count"`
	Items    []object.MarketMarketItem `json:"items"`
	ViewType int                       `json:"view_type"`
}

// MarketSearch searches market items in a community's catalog.
//
// https://vk.com/dev/market.search
func (vk *VK) MarketSearch(params Params) (response MarketSearchResponse, err error) {
	err = vk.RequestUnmarshal("market.search", &response, params)
	return
}

// MarketSearchItemsResponse struct.
type MarketSearchItemsResponse struct {
	Count    int                       `json:"count"`
	ViewType int                       `json:"view_type"`
	Items    []object.MarketMarketItem `json:"items"`
	Groups   []object.GroupsGroup      `json:"groups,omitempty"`
}

// MarketSearchItems method.
//
// https://vk.com/dev/market.searchItems
func (vk *VK) MarketSearchItems(params Params) (response MarketSearchItemsResponse, err error) {
	err = vk.RequestUnmarshal("market.searchItems", &response, params)
	return
}