forked from SevereCloud/vksdk
/
apps.go
149 lines (131 loc) · 4.54 KB
/
apps.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
package api // import "github.com/akss1/vksdk/5.92/api"
import (
"github.com/akss1/vksdk/5.92/object"
)
// AppsDeleteAppRequests deletes all request notifications from the current app.
//
// https://vk.com/dev/apps.deleteAppRequests
func (vk *VK) AppsDeleteAppRequests(params map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("apps.deleteAppRequests", params, &response, &vkErr)
return
}
// AppsGetResponse struct
type AppsGetResponse struct {
Count int `json:"count"`
Items []object.AppsApp `json:"items"`
Profiles []object.UsersUser `json:"profiles"`
Groups []object.GroupsGroup `json:"groups"`
}
// AppsGet returns applications data.
//
// https://vk.com/dev/apps.get
func (vk *VK) AppsGet(params map[string]string) (response AppsGetResponse, vkErr Error) {
vk.RequestUnmarshal("apps.get", params, &response, &vkErr)
return
}
// AppsGetCatalogResponse struct
type AppsGetCatalogResponse struct {
Count int `json:"count"`
Items []object.AppsApp `json:"items"`
Profiles []object.UsersUser `json:"profiles"`
Groups []object.GroupsGroup `json:"groups"`
}
// 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 map[string]string) (response AppsGetCatalogResponse, vkErr Error) {
vk.RequestUnmarshal("apps.getCatalog", params, &response, &vkErr)
return
}
// AppsGetFriendsListResponse struct
type AppsGetFriendsListResponse struct {
Count int `json:"count"`
Items []int `json:"profiles"`
}
// AppsGetFriendsList creates friends list for requests and invites in current app.
//
// extended=0
//
// https://vk.com/dev/apps.getFriendsList
func (vk *VK) AppsGetFriendsList(params map[string]string) (response AppsGetFriendsListResponse, vkErr Error) {
params["extended"] = "0"
vk.RequestUnmarshal("apps.getFriendsList", params, &response, &vkErr)
return
}
// AppsGetFriendsListExtendedResponse struct
type AppsGetFriendsListExtendedResponse struct {
Count int `json:"count"`
Items []object.UsersUser `json:"profiles"`
}
// AppsGetFriendsListExtended creates friends list for requests and invites in current app.
//
// extended=1
//
// https://vk.com/dev/apps.getFriendsList
func (vk *VK) AppsGetFriendsListExtended(params map[string]string) (response AppsGetFriendsListExtendedResponse, vkErr Error) {
params["extended"] = "1"
vk.RequestUnmarshal("apps.getFriendsList", params, &response, &vkErr)
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 map[string]string) (response AppsGetLeaderboardResponse, vkErr Error) {
params["extended"] = "0"
vk.RequestUnmarshal("apps.getLeaderboard", params, &response, &vkErr)
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 map[string]string) (response AppsGetLeaderboardExtendedResponse, vkErr Error) {
params["extended"] = "1"
vk.RequestUnmarshal("apps.getLeaderboard", params, &response, &vkErr)
return
}
// AppsGetScopesResponse struct
type AppsGetScopesResponse struct {
Count int `json:"count"`
Items []object.AppsScope `json:"items"`
}
// AppsGetScopes x
//
// https://vk.com/dev/apps.getScopes
func (vk *VK) AppsGetScopes(params map[string]string) (response AppsGetScopesResponse, vkErr Error) {
vk.RequestUnmarshal("apps.getScopes", params, &response, &vkErr)
return
}
// AppsGetScore returns user score in app.
//
// NOTE: vk wtf!?
//
// https://vk.com/dev/apps.getScore
func (vk *VK) AppsGetScore(params map[string]string) (response string, vkErr Error) {
vk.RequestUnmarshal("apps.getScore", params, &response, &vkErr)
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 map[string]string) (response int, vkErr Error) {
vk.RequestUnmarshal("apps.sendRequest", params, &response, &vkErr)
return
}