matterbridge/vendor/github.com/SevereCloud/vksdk/v2/api/users.go
Wim c4157a4d5b
Update dependencies (#2180)
* Update dependencies

* Fix whatsmeow API changes
2024-08-27 19:04:05 +02:00

105 lines
3.0 KiB
Go

package api // import "github.com/SevereCloud/vksdk/v2/api"
import (
"github.com/SevereCloud/vksdk/v2/object"
)
// UsersGetResponse users.get response.
type UsersGetResponse []object.UsersUser
// UsersGet returns detailed information on users.
//
// https://dev.vk.com/method/users.get
func (vk *VK) UsersGet(params Params) (response UsersGetResponse, err error) {
err = vk.RequestUnmarshal("users.get", &response, params)
return
}
// UsersGetFollowersResponse struct.
type UsersGetFollowersResponse struct {
Count int `json:"count"`
Items []int `json:"items"`
}
// UsersGetFollowers returns a list of IDs of followers of the user in
// question, sorted by date added, most recent first.
//
// fields="";
//
// https://dev.vk.com/method/users.getFollowers
func (vk *VK) UsersGetFollowers(params Params) (response UsersGetFollowersResponse, err error) {
err = vk.RequestUnmarshal("users.getFollowers", &response, params, Params{"fields": ""})
return
}
// UsersGetFollowersFieldsResponse struct.
type UsersGetFollowersFieldsResponse struct {
Count int `json:"count"`
Items []object.UsersUser `json:"items"`
}
// UsersGetFollowersFields returns a list of IDs of followers of the user in
// question, sorted by date added, most recent first.
//
// fields not empty.
//
// https://dev.vk.com/method/users.getFollowers
func (vk *VK) UsersGetFollowersFields(params Params) (response UsersGetFollowersFieldsResponse, err error) {
reqParams := make(Params)
if v, prs := params["fields"]; v == "" || !prs {
reqParams["fields"] = "id"
}
err = vk.RequestUnmarshal("users.getFollowers", &response, params, reqParams)
return
}
// UsersGetSubscriptionsResponse struct.
type UsersGetSubscriptionsResponse struct {
Users struct {
Count int `json:"count"`
Items []int `json:"items"`
} `json:"users"`
Groups struct {
Count int `json:"count"`
Items []int `json:"items"`
} `json:"groups"`
}
// UsersGetSubscriptions returns a list of IDs of users and public pages followed by the user.
//
// extended=0
//
// https://dev.vk.com/method/users.getSubscriptions
//
// BUG(SevereCloud): UsersGetSubscriptions bad response with extended=1.
func (vk *VK) UsersGetSubscriptions(params Params) (response UsersGetSubscriptionsResponse, err error) {
err = vk.RequestUnmarshal("users.getSubscriptions", &response, params, Params{"extended": false})
return
}
// UsersReport reports (submits a complain about) a user.
//
// https://dev.vk.com/method/users.report
func (vk *VK) UsersReport(params Params) (response int, err error) {
err = vk.RequestUnmarshal("users.report", &response, params)
return
}
// UsersSearchResponse struct.
type UsersSearchResponse struct {
Count int `json:"count"`
Items []object.UsersUser `json:"items"`
}
// UsersSearch returns a list of users matching the search criteria.
//
// https://dev.vk.com/method/users.search
func (vk *VK) UsersSearch(params Params) (response UsersSearchResponse, err error) {
err = vk.RequestUnmarshal("users.search", &response, params)
return
}