summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/api/apps.go
blob: f6f1742ba8ae14e08f645973854a43a38894698b (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
package api // import "github.com/SevereCloud/vksdk/v2/api"

import (
	"github.com/SevereCloud/vksdk/v2/object"
)

// AppsAddUsersToTestingGroup method.
//
// https://vk.com/dev/apps.addUsersToTestingGroup
func (vk *VK) AppsAddUsersToTestingGroup(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("apps.addUsersToTestingGroup", &response, params)
	return
}

// AppsDeleteAppRequests deletes all request notifications from the current app.
//
// https://vk.com/dev/apps.deleteAppRequests
func (vk *VK) AppsDeleteAppRequests(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("apps.deleteAppRequests", &response, params)
	return
}

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

// AppsGet returns applications data.
//
// https://vk.com/dev/apps.get
func (vk *VK) AppsGet(params Params) (response AppsGetResponse, err error) {
	err = vk.RequestUnmarshal("apps.get", &response, params)
	return
}

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

// AppsGetCatalog returns a list of applications (apps) available to users in the App Catalog.
//
// https://vk.com/dev/apps.getCatalog
func (vk *VK) AppsGetCatalog(params Params) (response AppsGetCatalogResponse, err error) {
	err = vk.RequestUnmarshal("apps.getCatalog", &response, params)
	return
}

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

// AppsGetFriendsList creates friends list for requests and invites in current app.
//
//	extended=0
//
// https://vk.com/dev/apps.getFriendsList
func (vk *VK) AppsGetFriendsList(params Params) (response AppsGetFriendsListResponse, err error) {
	err = vk.RequestUnmarshal("apps.getFriendsList", &response, params, Params{"extended": false})

	return
}

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

// AppsGetFriendsListExtended creates friends list for requests and invites in current app.
//
//	extended=1
//
// https://vk.com/dev/apps.getFriendsList
func (vk *VK) AppsGetFriendsListExtended(params Params) (response AppsGetFriendsListExtendedResponse, err error) {
	err = vk.RequestUnmarshal("apps.getFriendsList", &response, params, Params{"extended": true})

	return
}

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

// AppsGetLeaderboard returns players rating in the game.
//
//	extended=0
//
// https://vk.com/dev/apps.getLeaderboard
func (vk *VK) AppsGetLeaderboard(params Params) (response AppsGetLeaderboardResponse, err error) {
	err = vk.RequestUnmarshal("apps.getLeaderboard", &response, params, Params{"extended": false})

	return
}

// AppsGetLeaderboardExtendedResponse struct.
type AppsGetLeaderboardExtendedResponse struct {
	Count int `json:"count"`
	Items []struct {
		Score  int `json:"score"`
		UserID int `json:"user_id"`
	} `json:"items"`
	Profiles []object.UsersUser `json:"profiles"`
}

// AppsGetLeaderboardExtended returns players rating in the game.
//
//	extended=1
//
// https://vk.com/dev/apps.getLeaderboard
func (vk *VK) AppsGetLeaderboardExtended(params Params) (response AppsGetLeaderboardExtendedResponse, err error) {
	err = vk.RequestUnmarshal("apps.getLeaderboard", &response, params, Params{"extended": true})

	return
}

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

// AppsGetScopes ...
//
// TODO: write docs.
//
// https://vk.com/dev/apps.getScopes
func (vk *VK) AppsGetScopes(params Params) (response AppsGetScopesResponse, err error) {
	err = vk.RequestUnmarshal("apps.getScopes", &response, params)
	return
}

// AppsGetScore returns user score in app.
//
// NOTE: vk wtf!?
//
// https://vk.com/dev/apps.getScore
func (vk *VK) AppsGetScore(params Params) (response string, err error) {
	err = vk.RequestUnmarshal("apps.getScore", &response, params)
	return
}

// AppsGetTestingGroupsResponse struct.
type AppsGetTestingGroupsResponse []object.AppsTestingGroup

// AppsGetTestingGroups method.
//
// https://vk.com/dev/apps.getTestingGroups
func (vk *VK) AppsGetTestingGroups(params Params) (response AppsGetTestingGroupsResponse, err error) {
	err = vk.RequestUnmarshal("apps.getTestingGroups", &response, params)
	return
}

// AppsRemoveTestingGroup method.
//
// https://vk.com/dev/apps.removeTestingGroup
func (vk *VK) AppsRemoveTestingGroup(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("apps.removeTestingGroup", &response, params)
	return
}

// AppsRemoveUsersFromTestingGroups method.
//
// https://vk.com/dev/apps.removeUsersFromTestingGroups
func (vk *VK) AppsRemoveUsersFromTestingGroups(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("apps.removeUsersFromTestingGroups", &response, params)
	return
}

// AppsSendRequest sends a request to another user in an app that uses VK authorization.
//
// https://vk.com/dev/apps.sendRequest
func (vk *VK) AppsSendRequest(params Params) (response int, err error) {
	err = vk.RequestUnmarshal("apps.sendRequest", &response, params)
	return
}

// AppsUpdateMetaForTestingGroupResponse struct.
type AppsUpdateMetaForTestingGroupResponse struct {
	GroupID int `json:"group_id"`
}

// AppsUpdateMetaForTestingGroup method.
//
// https://vk.com/dev/apps.updateMetaForTestingGroup
func (vk *VK) AppsUpdateMetaForTestingGroup(params Params) (response AppsUpdateMetaForTestingGroupResponse, err error) {
	err = vk.RequestUnmarshal("apps.updateMetaForTestingGroup", &response, params)
	return
}