Documentation ¶
Overview ¶
Package easyvk provides you simple way to work with VK API.
Index ¶
- Constants
- type Account
- func (a *Account) BanUser(userID uint) (bool, error)
- func (a *Account) GetAppPermissions(userID uint) (AccountGetAppPermissionsResponse, error)
- func (a *Account) GetBanned(offset, count uint) (AccountGetBannedResponse, error)
- func (a *Account) GetCounters(filter string) (AccountGetCountersResponse, error)
- func (a *Account) GetInfo(fields string) (AccountGetInfoResponse, error)
- func (a *Account) GetProfileInfo() (AccountGetProfileInfoResponse, error)
- func (a *Account) SetOffline() (bool, error)
- func (a *Account) SetOnline(voip bool) (bool, error)
- func (a *Account) UnbanUser(userID uint) (bool, error)
- type AccountGetAppPermissionsResponse
- type AccountGetBannedResponse
- type AccountGetCountersResponse
- type AccountGetInfoResponse
- type AccountGetProfileInfoResponse
- type Board
- type BoardAddTopicParams
- type Error
- type Fave
- type FaveGetLinksResponse
- type FaveGetPhotosResponse
- type FaveGetUsersResponse
- type FaveGetVideosResponse
- type Likes
- func (l *Likes) Add(t likeType, ownerID int, itemID uint, accessKey string) (int, error)
- func (l *Likes) Delete(t likeType, ownerID int, itemID uint) (int, error)
- func (l *Likes) GetList(params LikesGetListParams) (LikesGetListResponse, error)
- func (l *Likes) IsLiked(userID uint, t likeType, ownerID int, itemID uint) (LikesIsLikedResponse, error)
- type LikesGetListParams
- type LikesGetListResponse
- type LikesIsLikedResponse
- type PhotoObject
- type Photos
- type PhotosGetWallUploadServerResponse
- type PhotosSaveWallPhotoParams
- type Status
- type Upload
- type UploadPhotoWallResponse
- type UserObject
- type VK
- type VideoObject
- type Wall
- type WallPostParams
Constants ¶
const ( // PostLikeType - post on user or community wall PostLikeType likeType = "post" // CommentLikeType - comment on a wall post CommentLikeType likeType = "comment" // PhotoLikeType - photo PhotoLikeType likeType = "photo" // AudioLikeType - audio AudioLikeType likeType = "audio" // VideoLikeType - video VideoLikeType likeType = "video" // NoteLikeType - note NoteLikeType likeType = "note" // MarketLikeType - market MarketLikeType likeType = "market" // PhotoCommentLikeType - comment on the photo PhotoCommentLikeType likeType = "photo_comment" // VideoCommentLikeType - comment on the video VideoCommentLikeType likeType = "video_comment" // TopicCommentLikeType - comment in the discussion TopicCommentLikeType likeType = "topic_comment" // MarketCommentLikeType - comment on the market MarketCommentLikeType likeType = "market_comment" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
An Account describes a set of methods to work with account. https://vk.com/dev/account
func (*Account) BanUser ¶
BanUser adds user to the banlist. https://vk.com/dev/account.banUser
func (*Account) GetAppPermissions ¶
func (a *Account) GetAppPermissions(userID uint) (AccountGetAppPermissionsResponse, error)
GetAppPermissions returns settings of the user in this application. https://vk.com/dev/account.getAppPermissions
func (*Account) GetBanned ¶
func (a *Account) GetBanned(offset, count uint) (AccountGetBannedResponse, error)
GetBanned returns a user's blacklist. https://vk.com/dev/account.getBanned
func (*Account) GetCounters ¶
func (a *Account) GetCounters(filter string) (AccountGetCountersResponse, error)
GetCounters returns values of user counters. https://vk.com/dev/account.getCounters
func (*Account) GetInfo ¶
func (a *Account) GetInfo(fields string) (AccountGetInfoResponse, error)
GetInfo returns current account info. https://vk.com/dev/account.getInfo
func (*Account) GetProfileInfo ¶
func (a *Account) GetProfileInfo() (AccountGetProfileInfoResponse, error)
GetProfileInfo returns the current account info. https://vk.com/dev/account.getProfileInfo
func (*Account) SetOffline ¶
SetOffline marks a current user as offline. https://vk.com/dev/account.setOffline
func (*Account) SetOnline ¶
SetOnline marks a current user as online for 5 minutes. https://vk.com/dev/account.setOnline
type AccountGetAppPermissionsResponse ¶
type AccountGetAppPermissionsResponse struct { Notify bool Friends bool Photos bool Audio bool Video bool Pages bool Status bool Notes bool Messages bool Wall bool Ads bool Offline bool Docs bool Groups bool Notifications bool Stats bool Email bool Market bool }
A AccountGetAppPermissionsResponse describes a set of app's permissions. https://vk.com/dev/account.getAppPermissions
type AccountGetBannedResponse ¶
type AccountGetBannedResponse struct { Count int `json:"count"` Items []UserObject }
A AccountGetBannedResponse describes a user's blacklist. https://vk.com/dev/account.getBanned
type AccountGetCountersResponse ¶
type AccountGetCountersResponse struct { Friends int `json:"friends"` FriendsSuggestions int `json:"friends_suggestions"` Messages int `json:"messages"` Photos int `json:"photos"` Videos int `json:"videos"` Gifts int `json:"gifts"` Events int `json:"events"` Groups int `json:"groups"` Notifications int `json:"notifications"` SDK int `json:"sdk"` AppRequests int `json:"app_requests"` }
A AccountGetCountersResponse describes a set of user's counters. https://vk.com/dev/account.getCounters
type AccountGetInfoResponse ¶
type AccountGetInfoResponse struct { Country string `json:"country"` HTTPS int `json:"https_required"` TwoFactor int `json:"2fa_required"` OwnPostsDefault int `json:"own_posts_default"` NoWallReplies int `json:"no_wall_replies"` Intro int `json:"intro"` Lang int `json:"lang"` }
An AccountGetInfoResponse describes a set of user's info. https://vk.com/dev/account.getInfo
type AccountGetProfileInfoResponse ¶
type AccountGetProfileInfoResponse struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` ScreenName string `json:"screen_name"` Sex int `json:"sex"` Relation int `json:"relation"` Birthday string `json:"bdate"` BirthVisibility int `json:"bdate_visibility"` Hometown string `json:"home_town"` Status string `json:"status"` Phone string `json:"phone"` Country struct { ID int `json:"id"` Title string `json:"title"` } `json:"country"` City struct { ID int `json:"id"` Title string `json:"title"` } `json:"city"` }
A AccountGetProfileInfoResponse describes a set of user's info. https://vk.com/dev/account.getProfileInfo
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
A Board describes a set of methods to work with topics. https://vk.com/dev/board
func (*Board) AddTopic ¶
func (b *Board) AddTopic(p BoardAddTopicParams) (int, error)
AddTopic creates a new topic on a community's discussion board. https://vk.com/dev/board.addTopic
func (*Board) CloseTopic ¶
CloseTopic closes a topic on a community's discussion board so that comments cannot be posted. https://vk.com/dev/board.closeTopic
func (*Board) DeleteTopic ¶
DeleteTopic deletes a topic from a community's discussion board. https://vk.com/dev/board.deleteTopic
type BoardAddTopicParams ¶
type BoardAddTopicParams struct { GroupID uint Title string Text string FromGroup bool Attachments string }
BoardAddTopicParams provides fields for AddTopic params. https://vk.com/dev/board.addTopic
type Error ¶
type Error struct { Code int `json:"error_code"` Message string `json:"error_msg"` RequestParams []struct { Key string `json:"key"` Value string `json:"value"` } `json:"request_params"` }
An Error describes vk errors info. https://vk.com/dev/errors
type Fave ¶
type Fave struct {
// contains filtered or unexported fields
}
A Fave describes a set of methods to work with faves. https://vk.com/dev/fave
func (*Fave) GetLinks ¶
func (f *Fave) GetLinks(offset, count uint) (FaveGetLinksResponse, error)
GetLinks returns a list of links that the current user has bookmarked. https://vk.com/dev/fave.getLinks
func (*Fave) GetPhotos ¶
func (f *Fave) GetPhotos(offset, count uint) (FaveGetPhotosResponse, error)
GetPhotos returns a list of photos that the current user has bookmarked. https://vk.com/dev/fave.getPhotos
func (*Fave) GetUsers ¶
func (f *Fave) GetUsers(offset, count uint) (FaveGetUsersResponse, error)
GetUsers returns a list of users whom the current user has bookmarked. https://vk.com/dev/fave.getUsers
func (*Fave) GetVideos ¶
func (f *Fave) GetVideos(offset, count uint) (FaveGetVideosResponse, error)
GetVideos returns a list of videos that the current user has bookmarked. https://vk.com/dev/fave.getVideos
type FaveGetLinksResponse ¶
type FaveGetLinksResponse struct { Count int `json:"count"` Items []struct { ID string `json:"id"` URL string `json:"url"` Title string `json:"title"` Description string `json:"description"` Photo50 string `json:"photo_50"` Photo100 string `json:"photo_100"` Photo200 string `json:"photo_200"` } `json:"items"` }
A FaveGetLinksResponse describes a list of links that the current user has bookmarked. https://vk.com/dev/fave.getLinks
type FaveGetPhotosResponse ¶
type FaveGetPhotosResponse struct { Count int `json:"count"` Items []PhotoObject }
A FaveGetPhotosResponse describes a list of photos that the current user has bookmarked. https://vk.com/dev/fave.getPhotos
type FaveGetUsersResponse ¶
type FaveGetUsersResponse struct { Count int `json:"count"` Items []UserObject }
A FaveGetUsersResponse describes a list of users whom the current user has bookmarked. https://vk.com/dev/fave.getUsers
type FaveGetVideosResponse ¶
type FaveGetVideosResponse struct { Count int `json:"count"` Items []VideoObject }
A FaveGetVideosResponse describes a list of videos that the current user has bookmarked. https://vk.com/dev/fave.getVideos
type Likes ¶
type Likes struct {
// contains filtered or unexported fields
}
A Likes describes a set of methods to work with likes. https://vk.com/dev/likes
func (*Likes) Add ¶
Add adds the specified object to the Likes list of the current user. https://vk.com/dev/likes.add
func (*Likes) Delete ¶
Delete deletes the specified object from the Likes list of the current user. https://vk.com/dev/likes.delete
func (*Likes) GetList ¶
func (l *Likes) GetList(params LikesGetListParams) (LikesGetListResponse, error)
GetList returns a list of IDs of users who added the specified object to their Likes list. https://vk.com/dev/likes.getList
func (*Likes) IsLiked ¶
func (l *Likes) IsLiked(userID uint, t likeType, ownerID int, itemID uint) (LikesIsLikedResponse, error)
IsLiked checks for the object in the Likes list of the specified user. https://vk.com/dev/likes.isLiked
type LikesGetListParams ¶
type LikesGetListParams struct { Type likeType OwnerID int ItemID int PageURL string Filter string FriendsOnly bool Offset uint Count uint SkipOwner bool }
LikesGetListParams provides struct for getList parameters. https://vk.com/dev/likes.getList
type LikesGetListResponse ¶
type LikesGetListResponse struct { Count int `json:"count"` Items []UserObject }
LikesGetListResponse provides structure for getList response. https://vk.com/dev/likes.getList
type LikesIsLikedResponse ¶
LikesIsLikedResponse describes info about like and repost. https://vk.com/dev/likes.isLiked
type PhotoObject ¶
type PhotoObject struct { ID int `json:"id"` AlbumID int `json:"album_id"` OwnerID int `json:"owner_id"` UserID int `json:"user_id"` Sizes []struct { Src string `json:"src"` Width int `json:"width"` Height int `json:"height"` Type string `json:"type"` } `json:"sizes"` Text string `json:"text"` Date int `json:"date"` PostID int `json:"post_id"` Width int `json:"width"` Height int `json:"height"` Photo75 string `json:"photo_75"` Photo130 string `json:"photo_130"` Photo604 string `json:"photo_604"` Photo807 string `json:"photo_807"` Photo1280 string `json:"photo_1280"` Photo2560 string `json:"photo_2560"` Likes struct { UserLikes int `json:"user_likes"` Count int `json:"count"` } `json:"likes"` Reposts struct { Count int `json:"count"` } `json:"reposts"` Comments struct { Count int `json:"count"` } `json:"comments"` CanComment int `json:"can_comment"` Tags struct { Count int `json:"count"` } `json:"tags"` }
A PhotoObject contains information about photo. https://vk.com/dev/objects/photo
type Photos ¶
type Photos struct {
// contains filtered or unexported fields
}
A Photos describes a set of methods to work with photos. https://vk.com/dev/photos
func (*Photos) GetWallUploadServer ¶
func (p *Photos) GetWallUploadServer(groupID uint) (PhotosGetWallUploadServerResponse, error)
GetWallUploadServer returns the server address for photo upload onto a user's wall. https://vk.com/dev/photos.getWallUploadServer
func (*Photos) SaveWallPhoto ¶
func (p *Photos) SaveWallPhoto(par PhotosSaveWallPhotoParams) ([]PhotoObject, error)
SaveWallPhoto saves a photo to a user's or community's wall after being uploaded. For upload look at file upload.go. https://vk.com/dev/photos.saveWallPhoto
type PhotosGetWallUploadServerResponse ¶
type PhotosGetWallUploadServerResponse struct { UploadURL string `json:"upload_url"` AlbumID int `json:"album_id"` UserID int `json:"user_id"` }
PhotosGetWallUploadServerResponse describes the server address for photo upload onto a user's wall. https://vk.com/dev/photos.getWallUploadServer
type PhotosSaveWallPhotoParams ¶
type PhotosSaveWallPhotoParams struct { UserID uint GroupID uint Photo string Hash string Caption string Server int Lat float64 Long float64 }
PhotosSaveWallPhotoParams provides structure for parameters for saveWallPhoto method. https://vk.com/dev/photos.saveWallPhoto
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
A Status describes a set of methods to work with status. https://vk.com/dev/status
func (*Status) Get ¶
Get returns data required to show the status of a user or community https://vk.com/dev/status.get
type Upload ¶
type Upload struct{}
An Upload describes a set of methods that helps with update to VK servers.
type UploadPhotoWallResponse ¶
type UploadPhotoWallResponse struct { Server int `json:"server"` Photo string `json:"photo"` Hash string `json:"hash"` }
A UploadPhotoWallResponse describes an info about uploaded photo.
type UserObject ¶
type UserObject struct { ID int `json:"id"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Sex int `json:"sex"` Nickname string `json:"nickname"` MaidenName string `json:"maiden_name"` Domain string `json:"domain"` ScreenName string `json:"screen_name"` Bdate string `json:"bdate"` City struct { ID int `json:"id"` Title string `json:"title"` } `json:"city"` Country struct { ID int `json:"id"` Title string `json:"title"` } `json:"country"` Photo50 string `json:"photo_50"` Photo100 string `json:"photo_100"` Photo200 string `json:"photo_200"` PhotoMax string `json:"photo_max"` Photo200Orig string `json:"photo_200_orig"` Photo400Orig string `json:"photo_400_orig"` PhotoMaxOrig string `json:"photo_max_orig"` PhotoID string `json:"photo_id"` HasPhoto int `json:"has_photo"` HasMobile int `json:"has_mobile"` IsFriend int `json:"is_friend"` FriendStatus int `json:"friend_status"` Online int `json:"online"` WallComments int `json:"wall_comments"` CanPost int `json:"can_post"` CanSeeAllPosts int `json:"can_see_all_posts"` CanSeeAudio int `json:"can_see_audio"` CanWritePrivateMessage int `json:"can_write_private_message"` CanSendFriendRequest int `json:"can_send_friend_request"` MobilePhone string `json:"mobile_phone"` HomePhone string `json:"home_phone"` Site string `json:"site"` Status string `json:"status"` LastSeen struct { Time int `json:"time"` Platform int `json:"platform"` } `json:"last_seen"` CropPhoto struct { Photo struct { ID int `json:"id"` AlbumID int `json:"album_id"` OwnerID int `json:"owner_id"` Photo75 string `json:"photo_75"` Photo130 string `json:"photo_130"` Photo604 string `json:"photo_604"` Width int `json:"width"` Height int `json:"height"` Text string `json:"text"` Date int `json:"date"` PostID int `json:"post_id"` } `json:"photo"` Crop struct { X float64 `json:"x"` Y float64 `json:"y"` X2 float64 `json:"x2"` Y2 float64 `json:"y2"` } `json:"crop"` Rect struct { X int `json:"x"` Y int `json:"y"` X2 int `json:"x2"` Y2 int `json:"y2"` } `json:"rect"` } `json:"crop_photo"` Verified int `json:"verified"` FollowersCount int `json:"followers_count"` Blacklisted int `json:"blacklisted"` BlacklistedByMe int `json:"blacklisted_by_me"` IsFavorite int `json:"is_favorite"` IsHiddenFromFeed int `json:"is_hidden_from_feed"` CommonCount int `json:"common_count"` Career []interface{} `json:"career"` Military []interface{} `json:"military"` University int `json:"university"` UniversityName string `json:"university_name"` Faculty int `json:"faculty"` FacultyName string `json:"faculty_name"` Graduation int `json:"graduation"` HomeTown string `json:"home_town"` Relation int `json:"relation"` Personal struct { Religion string `json:"religion"` InspiredBy string `json:"inspired_by"` PeopleMain int `json:"people_main"` LifeMain int `json:"life_main"` Smoking int `json:"smoking"` Alcohol int `json:"alcohol"` } `json:"personal"` Interests string `json:"interests"` Music string `json:"music"` Activities string `json:"activities"` Movies string `json:"movies"` Tv string `json:"tv"` Books string `json:"books"` Games string `json:"games"` Universities []interface{} `json:"universities"` Schools []interface{} `json:"schools"` About string `json:"about"` Relatives []interface{} `json:"relatives"` Quotes string `json:"quotes"` Deactivated string `json:"deactivated"` }
An UserObject contains information about user. https://vk.com/dev/objects/user
type VK ¶
type VK struct { AccessToken string Version string Account Account Board Board Fave Fave Likes Likes Photos Photos Status Status Upload Upload Wall Wall }
VK defines a set of functions for working with VK API.
func WithAuth ¶
WithAuth helps to initialize your VK object with signing in by login, password, client id and scope Scope must be a string like "friends,wall"
type VideoObject ¶
type VideoObject struct { ID int `json:"id"` OwnerID int `json:"owner_id"` Title string `json:"title"` Duration int `json:"duration"` Description string `json:"description"` Date int `json:"date"` Comments int `json:"comments"` Views int `json:"views"` Width int `json:"width"` Height int `json:"height"` Photo130 string `json:"photo_130"` Photo320 string `json:"photo_320"` Photo800 string `json:"photo_800"` AddingDate int `json:"adding_date"` Files struct { Mp4240 string `json:"mp4_240"` Mp4360 string `json:"mp4_360"` Mp4480 string `json:"mp4_480"` Mp4720 string `json:"mp4_720"` } `json:"files"` Player string `json:"player"` CanAdd int `json:"can_add"` CanComment int `json:"can_comment"` CanRepost int `json:"can_repost"` Likes struct { UserLikes int `json:"user_likes"` Count int `json:"count"` } `json:"likes"` Reposts struct { Count int `json:"count"` UserReposted int `json:"user_reposted"` } `json:"reposts"` Repeat int `json:"repeat"` }
A VideoObject contains information about video. https://vk.com/dev/objects/video
type Wall ¶
type Wall struct {
// contains filtered or unexported fields
}
A Wall describes a set of methods to work with wall. https://vk.com/dev/wall
func (*Wall) Post ¶
func (w *Wall) Post(p WallPostParams) (int, error)
Post adds a new post on a user wall or community wall. Can also be used to publish suggested or scheduled posts. Returns id of created post. https://vk.com/dev/wall.post
type WallPostParams ¶
type WallPostParams struct { OwnerID int FriendsOnly bool FromGroup bool Signed bool MarkAsAds bool AdsPromotedStealth bool Message string Attachments string Services string GUID string PublishDate uint PlaceID uint PostID uint Lat float64 Long float64 }
WallPostParams provides structure for post method. https://vk.com/dev/wall.post