vkapi

package module
v0.0.0-...-063ae1a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

README

VK API wrapper in golang

Installing

go get github.com/himidori/golang-vk-api

Authorizing using username and password

client, err := vkapi.NewVKClient(vkapi.DeviceIPhone, "username", "password")

Authorizing using access token

client, err := vkapi.NewVKClientWithToken("token", nil)

Listening longpoll events

// listening received messages
client.AddLongpollCallback("msgin", func(m *vkapi.LongPollMessage) {
	fmt.Printf("new message received from uid %d\n", m.UserID)
})

// listening deleted messages
client.AddLongpollCallback("msgdel", func(m *vkapi.LongPollMessage) {
	fmt.Printf("message %d was deleted\n", m.MessageID)
})

// listening sent messages
client.AddLongpollCallback("msgout", func(m *vkapi.LongPollMessage) {
	fmt.Printf("sent message to uid %d\n", m.UserID)
})

// listening read messages
client.AddLongpollCallback("msgread", func(m *vkapi.LongPollMessage) {
	fmt.Printf("message %d was read\n", m.MessageID)
})

// listening users online
client.AddLongpollCallback("msgonline", func(m *vkapi.LongPollMessage) {
	fmt.Printf("user %d is now online\n", m.UserID)

// starting 
client.ListenLongPollServer()

Documentation

Index

Constants

View Source
const (
	DeviceIPhone = iota
	DeviceWPhone
	DeviceAndroid
)
View Source
const (
	TypePost         = "post"
	TypeComment      = "comment"
	TypePhoto        = "photo"
	TypeDocument     = "doc"
	TypeAudio        = "audio"
	TypeVideo        = "video"
	TypeNote         = "note"
	TypePhotoComment = "photo_comment"
	TypeVideoComment = "video_comment"
	TypeTopicComment = "topic_comment"
	TypeSitepage     = "sitepage"
)
View Source
const (
	ActivityTypeTyping   = "typing"
	ActivityTypeAudioMsg = "audiomessage"
)
View Source
const (
	PlatformMobile
	PlatformIPhone
	PlatfromIPad
	PlatformAndroid
	PlatformWPhone
	PlatformWindows
	PlatformWeb
)

last seen device

Variables

This section is empty.

Functions

func ArrayToStr

func ArrayToStr(a []int) string

func BoolToInt

func BoolToInt(a bool) int

func GetFilesSizeMB

func GetFilesSizeMB(files []string) (int, error)

func IntToBool

func IntToBool(a int) bool

Types

type APIResponse

type APIResponse struct {
	Response      json.RawMessage `json:"response"`
	ResponseError Error           `json:"error"`
}

type Attachment

type Attachment struct {
	Type    string             `json:"type"`
	Photo   *AttachmentPhoto   `json:"photo"`
	Video   *AttachmentVideo   `json:"video"`
	Audio   *AttachmentAudio   `json:"audio"`
	Doc     *AttachmentDoc     `json:"doc"`
	Sticker *AttachmentSticker `json:"sticker"`
}

type AttachmentAudio

type AttachmentAudio struct {
	Artist     string                   `json:"artist"`
	ID         int                      `json:"id"`
	OwnerID    int                      `json:"owner_id"`
	Title      string                   `json:"title"`
	Duration   int                      `json:"duration"`
	AccessKey  string                   `json:"access_key"`
	IsLicensed bool                     `json:"is_licensed"`
	TrackCode  string                   `json:"track_code"`
	Url        string                   `json:"url"`
	Date       int64                    `json:"date"`
	Album      *AttachmentAudioAlbum    `json:"album"`
	MainArtist []*AttachmentAudioArtist `json:"main_artist"`
}

type AttachmentAudioAlbum

type AttachmentAudioAlbum struct {
	ID        int                        `json:"id"`
	Title     string                     `json:"title"`
	OwnerID   int                        `json:"owner_id"`
	AccessKey string                     `json:"access_key"`
	Thumb     *AttachmentAudioAlbumThumb `json:"thumb"`
}

type AttachmentAudioAlbumThumb

type AttachmentAudioAlbumThumb struct {
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	Photo34  string `json:"photo_34"`
	Photo68  string `json:"photo_68"`
	Photo135 string `json:"photo_135"`
	Photo270 string `json:"photo_270"`
	Photo300 string `json:"photo_300"`
	Photo600 string `json:"photo_600"`
}

type AttachmentAudioArtist

type AttachmentAudioArtist struct {
	Name   string `json:"name"`
	Domain string `json:"domain"`
	ID     string `json:"id"`
}

type AttachmentDoc

type AttachmentDoc struct {
	ID         int    `json:"id"`
	OwnerID    int    `json:"owner_id"`
	Title      string `json:"title"`
	Size       int    `json:"size"`
	Ext        string `json:"ext"`
	Url        string `json:"url"`
	Date       int64  `json:"date"`
	Type       int    `json:"type"`
	IsLicensed int    `json:"is_licensed"` // NOTE(Pedro): There is some inconsistency on VK API, this field can return "true" or zero for false
	AccessKey  string `json:"access_key"`
}

type AttachmentImageInfo

type AttachmentImageInfo struct {
	Type        string `json:"type"`
	Url         string `json:"url"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	WithPadding int    `json:"with_padding"`
}

type AttachmentPhoto

type AttachmentPhoto struct {
	ID        int                    `json:"id"`
	AlbumID   int                    `json:"album_id"`
	OwnerID   int                    `json:"owner_id"`
	UserID    int                    `json:"user_id"`
	Sizes     []*AttachmentImageInfo `json:"sizes"`
	Text      string                 `json:"text"`
	Date      int64                  `json:"date"`
	AccessKey string                 `json:"access_key"`
	PostID    int                    `json:"post_id"`
}

type AttachmentSticker

type AttachmentSticker struct {
	ProductID            int                    `json:"product_id"`
	StickerID            int                    `json:"sticker_id"`
	Images               []*AttachmentImageInfo `json:"images"`
	ImagesWithBackground []*AttachmentImageInfo `json:"images_with_background"`
}

type AttachmentVideo

type AttachmentVideo struct {
	AccessKey     string                 `json:"access_key"`
	CanComment    int                    `json:"can_comment"`
	CanEdit       int                    `json:"can_edit"`
	CanLike       int                    `json:"can_like"`
	CanRepost     int                    `json:"can_repost"`
	CanSubscribe  int                    `json:"can_subscribe"`
	CanAddToFaves int                    `json:"can_add_to_faves"`
	CanAdd        int                    `json:"can_add"`
	CanAttachLink int                    `json:"can_attach_link"`
	Comments      int                    `json:"comments"`
	Date          int64                  `json:"date"`
	Description   string                 `json:"description"`
	Duration      int                    `json:"duration"`
	Image         []*AttachmentImageInfo `json:"image"`
	FirstFrame    []*AttachmentImageInfo `json:"first_frame"`
	Width         int                    `json:"width"`
	Height        int                    `json:"height"`
	ID            int                    `json:"id"`
	OwnerID       int                    `json:"owner_id"`
	UserID        int                    `json:"user_id"`
	Title         string                 `json:"title"`
	IsFavorite    int                    `json:"is_favorite"`
	TrackCode     string                 `json:"track_code"`
	Type          string                 `json:"type"`
	Views         int                    `json:"views"`
	LocalViews    int                    `json:"local_views"`
	Platform      string                 `json:"platform"`
}

type AudioAttachment

type AudioAttachment struct {
	ID        int    `json:"id"`
	OwnerID   int    `json:"owner_id"`
	Artist    string `json:"artist"`
	Title     string `json:"title"`
	Duration  int    `json:"duration"`
	URL       string `json:"url"`
	Performer string `json:"performer"`
}

type BotlLongPollDM

type BotlLongPollDM struct {
	MessageID    int                 `json:"id"`
	Date         int64               `json:"date"`
	PeerID       int64               `json:"peer_id"`
	SendByID     int64               `json:"from_id"`
	Text         string              `json:"text"`
	RandomID     int64               `json:"random_id"`
	Attachments  []MessageAttachment `json:"attachments"`
	Isimportant  bool                `json:"important"`
	FwdMessages  []BotlLongPollDM    `json:"fwd_messages"`
	ReplyMessage *BotlLongPollDM     `json:"reply_message"`
}

type BotsLongPollEvent

type BotsLongPollEvent struct {
	Type   string             `json:"type"`
	Object BotsLongPollObject `json:"object"`
}

type BotsLongPollObject

type BotsLongPollObject struct {
	Message    BotlLongPollDM `json:"message"`
	ClientInfo interface{}    `json:"client_info`
}

type BotsLongPollServer

type BotsLongPollServer struct {
	Key    string `json:"key"`
	Server string `json:"server"`
	TS     string `json:"ts"`
}

type BotsLongPollUpdate

type BotsLongPollUpdate struct {
	Failed  int                 `json:"failed"`
	TS      string              `json:"ts"`
	Updates []BotsLongPollEvent `json:"updates"`
}

type Comment

type Comment struct {
	Count   int `json:"count"`
	CanPost int `json:"can_post"`
}

type Comments

type Comments struct {
	Count      int             `json:"count"`
	Comments   []*TopicComment `json:"items"`
	Poll       *Poll           `json:"poll"`
	Profiles   []*User         `json:"profiles"`
	RealOffset int             `json:"real_offset"`
}

type Dialog

type Dialog struct {
	Count    int     `json:"count"`
	Messages []*Item `json:"items"`
}

type DialogMessage

type DialogMessage struct {
	MID               int                  `json:"id"`
	Date              int64                `json:"date"`
	Out               int                  `json:"out"`
	UID               int                  `json:"user_id"`
	ReadState         int                  `json:"read_state"`
	Title             string               `json:"title"`
	Body              string               `json:"body"`
	RandomID          int                  `json:"random_id"`
	ChatID            int64                `json:"chat_id"`
	ChatActive        string               `json:"chat_active"`
	PushSettings      *Push                `json:"push_settings"`
	UsersCount        int                  `json:"users_count"`
	AdminID           int                  `json:"admin_id"`
	Photo50           string               `json:"photo_50"`
	Photo100          string               `json:"photo_100"`
	Photo200          string               `json:"photo_200"`
	ForwardedMessages []*ForwardedMessage  `json:"fwd_messages"`
	Attachments       []*MessageAttachment `json:"attachments"`
}

type DocAttachment

type DocAttachment struct {
	ID         int    `json:"id"`
	OwnerID    int    `json:"owner_id"`
	Title      string `json:"title"`
	Size       int    `json:"size"`
	Extenstion string `json:"ext"`
	URL        string `json:"url"`
	Date       int64  `json:"date"`
	Type       int    `json:"type"`
	IsLicensed int    `json:"is_licensed"`
}

type Docs

type Docs struct {
	Count     int              `json:"count"`
	Documents []*DocAttachment `json:"items"`
}

type Error

type Error struct {
	ErrorCode int    `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

type ForwardedMessage

type ForwardedMessage struct {
	UID               int                  `json:"user_id"`
	Date              int64                `json:"date"`
	Body              string               `json:"body"`
	Attachments       []*MessageAttachment `json:"attachments"`
	ForwardedMessages []*ForwardedMessage  `json:"fwd_messages"`
}

type Friends

type Friends struct {
	Count int     `json:"count"`
	Users []*User `json:"items"`
}

type FriendsRequests

type FriendsRequests struct {
	Count    int        `json:"count"`
	Requests []*Request `json:"items"`
}

type Group

type Group struct {
	ID                int             `json:"id"`
	Name              string          `json:"name"`
	ScreenName        string          `json:"screen_name"`
	Description       string          `json:"description"`
	Activity          string          `json:"activity"`
	Contacts          []*GroupContact `json:"contacts"`
	IsClosed          int             `json:"is_closed"`
	Type              string          `json:"type"`
	IsAdmin           int             `json:"is_admin"`
	IsMember          int             `json:"is_member"`
	HasPhoto          int             `json:"has_photo"`
	IsMessagesBlocked int             `json:"is_messages_blocked"`
	Photo50           string          `json:"photo_50"`
	Photo100          string          `json:"photo_100"`
	Photo200          string          `json:"photo_200"`
	AgeLimit          int             `json:"age_limits"`
	CanCreateTopic    int             `json:"can_create_topic"`
	CanMessage        int             `json:"can_message"`
	CanPost           int             `json:"can_post"`
	CanSeeAllPosts    int             `json:"can_see_all_posts"`
}

type GroupContact

type GroupContact struct {
	UID         int    `json:"user_id"`
	Description string `json:"desc"`
}

type GroupMembers

type GroupMembers struct {
	Count   int     `json:"count"`
	Members []*User `json:"items"`
}

type GroupSearchResult

type GroupSearchResult struct {
	Count  int      `json:"count"`
	Groups []*Group `json:"items"`
}

type HistoryAttachment

type HistoryAttachment struct {
	Attachments []HistoryAttachmentItem `json:"items"`
	NextFrom    string                  `json:"next_from"`
}

type HistoryAttachmentItem

type HistoryAttachmentItem struct {
	MID        int                `json:"message_id"`
	Attachment *MessageAttachment `json:"attachment"`
}

type Item

type Item struct {
	Message *DialogMessage `json:"message"`
	InRead  int            `json:"in_read"`
	OutRead int            `json:"out_read"`
}

type LastSeen

type LastSeen struct {
	Time     int64 `json:"time"`
	Platform int   `json:"platform"`
}

type Like

type Like struct {
	Count      int `json:"count"`
	UserLikes  int `json:"user_likes"`
	CanLike    int `json:"can_like"`
	CanPublish int `json:"can_publish"`
}

type LikeUser

type LikeUser struct {
	Type      string `json:"profile"`
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

type Likes

type Likes struct {
	Count int         `json:"count"`
	Users []*LikeUser `json:"items"`
}

type LinkAttachment

type LinkAttachment struct {
	URL         string `json:"url"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Target      string `json:"target"`
}

type LongPollMessage

type LongPollMessage struct {
	MessageType  string
	MessageID    int
	MessageFlags int
	UserID       int64
	Date         int64
	Title        string
	Body         string
	Attachments  map[string]string
}

type LongPollServer

type LongPollServer struct {
	Key    string `json:"key"`
	Server string `json:"server"`
	TS     int64  `json:"ts"`
}

type LongPollUpdate

type LongPollUpdate struct {
	Failed  int             `json:"failed"`
	TS      int64           `json:"ts"`
	Updates [][]interface{} `json:"updates"`
}

type Message

type Message struct {
	Count    int              `json:"count"`
	Messages []*DialogMessage `json:"items"`
}

type MessageAttachment

type MessageAttachment struct {
	Type     string             `json:"type"`
	Audio    *AudioAttachment   `json:"audio"`
	Video    *VideoAttachment   `json:"video"`
	Photo    *PhotoAttachment   `json:"photo"`
	Document *DocAttachment     `json:"doc"`
	Link     *LinkAttachment    `json:"link"`
	Wall     *WallPost          `json:"wall"`
	Sticker  *StickerAttachment `json:"sticker"`
}

type Mutual

type Mutual struct {
	Count int   `json:"count"`
	Users []int `json:"users"`
}

type OnlineInfo

type OnlineInfo struct {
	Visible  bool  `json:"visible"`
	LastSeen int64 `json:"last_seen"`
}

type Photo

type Photo struct {
	PhotoAttachment
}

type PhotoAttachment

type PhotoAttachment struct {
	ID        int          `json:"id"`
	AID       int          `json:"album_id"`
	OwnerID   int          `json:"owner_id"`
	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"`
	Width     int          `json:"width"`
	Height    int          `json:"height"`
	Text      string       `json:"text"`
	Created   int64        `json:"created"`
	AccessKey string       `json:"access_key"`
	Sizes     []*PhotoSize `json:"sizes"`
}

func (*PhotoAttachment) UrlWithMaxSize

func (photo *PhotoAttachment) UrlWithMaxSize() string

type PhotoSize

type PhotoSize struct {
	Type   string `json:"type"`
	Url    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

type Poll

type Poll struct {
	ID        int           `json:"id"`
	OwnerID   int           `json:"owner_id"`
	Created   int64         `json:"created"`
	Question  string        `json:"question"`
	Votes     int           `json:"votes"`
	Answers   []*PollAnswer `json:"answers"`
	Anonymous bool          `json:"anonymous"`
	Multiple  bool          `json:"multiple"`
	AnswerIDS []int         `json:"answer_ids"`
	EndDate   int64         `json:"end_date"`
	Closed    bool          `json:"closed"`
	IsBoard   bool          `json:"is_board"`
	CanEdit   bool          `json:"can_edit"`
	CanVote   bool          `json:"can_vote"`
	CanReport bool          `json:"can_report"`
	CanShare  bool          `json:"can_share"`
}

type PollAnswer

type PollAnswer struct {
	ID    int     `json:"id"`
	Text  string  `json:"text"`
	Votes int     `json:"votes"`
	Rate  float64 `json:"rate"`
}

type Push

type Push struct {
	Sound         int   `json:"sound"`
	DisabledUntil int64 `json:"disabled_until"`
}

type Repost

type Repost struct {
	Count        int `json:"count"`
	UserReposted int `json:"user_reposted"`
}

type Request

type Request struct {
	UserID        int     `json:"user_id"`
	MutualFriends *Mutual `json:"mutual"`
}

type ResolveScreenName

type ResolveScreenName struct {
	Type     string `json:"type"`
	ObjectID int    `json:"object_id"`
}

type Source

type Source struct {
	Type string `json:"type"`
}

type StickerAttachment

type StickerAttachment struct {
	ID        int    `json:"id"`
	ProductID int    `json:"product_id"`
	Photo64   string `json:"photo_64"`
	Photo128  string `json:"photo_128"`
	Photo256  string `json:"photo_256"`
	Photo352  string `json:"photo_352"`
	Photo512  string `json:"photo_512"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
}

type Token

type Token struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	UID              int    `json:"user_id"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	FirstName        string
	LastName         string
	PicSmall         string
	PicMedium        string
	PicBig           string
}

type TokenOptions

type TokenOptions struct {
	ServiceToken    bool
	ValidateOnStart bool
}

type Topic

type Topic struct {
	ID           int    `json:"id"`
	Title        string `json:"title"`
	Created      int64  `json:"created"`
	CreatedBy    int    `json:"created_by"`
	Updated      int64  `json:"updated"`
	UpdatedBy    int    `json:"updated_by"`
	IsClosed     int    `json:"is_closed"`
	IsFixed      int    `json:"is_fixed"`
	Comments     int    `json:"comments"`
	FirstComment string `json:"first_comment"`
	LastComment  string `json:"last_comment"`
}

type TopicComment

type TopicComment struct {
	ID          int               `json:"id"`
	FromID      int               `json:"from_id"`
	Date        int64             `json:"date"`
	Text        string            `json:"text"`
	Likes       *TopicCommentLike `json:"likes"`
	ReplyToUID  int               `json:"reply_to_uid"`
	ReplyToCID  int               `json:"reply_to_cid"`
	Attachments []*Attachment     `json:"attachments"`
}

type TopicCommentLike

type TopicCommentLike struct {
	Count     int `json:"count"`
	UserLikes int `json:"user_likes"`
	CanLike   int `json:"can_like"`
}

type Topics

type Topics struct {
	Count        int      `json:"count"`
	Topics       []*Topic `json:"items"`
	DefaultOrder float64  `json:"default_order"`
	CanAddTopics int      `json:"can_add_topics"`
	Profiles     []*User  `json:"profiles"`
}

type User

type User struct {
	UID                     int          `json:"id"`
	FirstName               string       `json:"first_name"`
	LastName                string       `json:"last_name"`
	Sex                     int          `json:"sex"`
	Nickname                string       `json:"nickname"`
	ScreenName              string       `json:"screen_name"`
	BDate                   string       `json:"bdate"`
	City                    *UserCity    `json:"city"`
	Country                 *UserCountry `json:"country"`
	Photo                   string       `json:"photo"`
	PhotoMedium             string       `json:"photo_medium"`
	PhotoBig                string       `json:"photo_big"`
	Photo50                 string       `json:"photo_50"`
	Photo100                string       `json:"photo_100"`
	HasMobile               int          `json:"has_mobile"`
	Online                  int          `json:"online"`
	OnlineInfo              *OnlineInfo  `json:"online_info"`
	CanPost                 int          `json:"can_post"`
	CanSeeAllPosts          int          `json:"can_see_all_posts"`
	CanWritePrivateMessages int          `json:"can_write_private_message"`
	Status                  string       `json:"activity"`
	LastOnline              *LastSeen    `json:"last_seen"`
	Hidden                  int          `json:"hidden"`
	Deactivated             string       `json:"deactivated"`
	Relation                int          `json:"relation"`
}

type UserCity

type UserCity struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

type UserCountry

type UserCountry struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

type VKClient

type VKClient struct {
	Self   Token
	Client *http.Client
	// contains filtered or unexported fields
}

func NewVKClient

func NewVKClient(device int, user string, password string) (*VKClient, error)

func NewVKClientWithToken

func NewVKClientWithToken(token string, options *TokenOptions) (*VKClient, error)

func (*VKClient) AddLongpollCallback

func (client *VKClient) AddLongpollCallback(name string, f func(*LongPollMessage))

func (*VKClient) BoardAddTopic

func (client *VKClient) BoardAddTopic(groupID int, title string, text string, fromGroup bool, attachments []string) (int, error)

func (*VKClient) BoardCloseTopic

func (client *VKClient) BoardCloseTopic(groupID int, topicID int) (bool, error)

func (*VKClient) BoardCreateComment

func (client *VKClient) BoardCreateComment(groupID int, topicID int, message string, attachments []string, fromGroup bool, stickerID int) (int, error)

func (*VKClient) BoardDeleteComment

func (client *VKClient) BoardDeleteComment(groupID int, topicID int, commetID int) (bool, error)

func (*VKClient) BoardDeleteTopic

func (client *VKClient) BoardDeleteTopic(groupID int, topicID int) (bool, error)

func (*VKClient) BoardEditComment

func (client *VKClient) BoardEditComment(groupID int, topicID int, commentID int, message string, attachments []string) (bool, error)

func (*VKClient) BoardEditTopic

func (client *VKClient) BoardEditTopic(groupID int, topicID int, title string) (bool, error)

func (*VKClient) BoardFixTopic

func (client *VKClient) BoardFixTopic(groupID int, topicID int) (bool, error)

func (*VKClient) BoardGetComments

func (client *VKClient) BoardGetComments(groupID int, topicID int, count int, params url.Values) (*Comments, error)

func (*VKClient) BoardGetTopics

func (client *VKClient) BoardGetTopics(groupID int, count int, params url.Values) (*Topics, error)

func (*VKClient) BoardOpenTopic

func (client *VKClient) BoardOpenTopic(groupID int, topicID int) (bool, error)

func (*VKClient) BoardRestoreComment

func (client *VKClient) BoardRestoreComment(groupID int, topicID int, commentID int) (bool, error)

func (*VKClient) BoardUnfixTopic

func (client *VKClient) BoardUnfixTopic(groupID int, topicID int) (bool, error)

func (*VKClient) DeleteLongpollCallback

func (client *VKClient) DeleteLongpollCallback(name string)

func (*VKClient) DialogsGet

func (client *VKClient) DialogsGet(count int, params url.Values) (*Dialog, error)

func (*VKClient) DocsSearch

func (client *VKClient) DocsSearch(query string, count int, params url.Values) (int, []*DocAttachment, error)

func (*VKClient) FriendsAdd

func (client *VKClient) FriendsAdd(userID int, text string, follow int) error

func (*VKClient) FriendsDelete

func (client *VKClient) FriendsDelete(userID int) error

func (*VKClient) FriendsGet

func (client *VKClient) FriendsGet(uid int, count int) (int, []*User, error)

func (*VKClient) FriendsGetRequests

func (client *VKClient) FriendsGetRequests(count int, out int) (int, []*Request, error)

func (*VKClient) GetDocsString

func (client *VKClient) GetDocsString(docs []*DocAttachment) string

func (*VKClient) GetHistoryAttachments

func (client *VKClient) GetHistoryAttachments(peerID int, mediaType string, count int, params url.Values) (*HistoryAttachment, error)

func (*VKClient) GetPhotosString

func (client *VKClient) GetPhotosString(photos []*PhotoAttachment) string

func (*VKClient) GroupGet

func (client *VKClient) GroupGet(userID int, count int) (int, []*Group, error)

func (*VKClient) GroupGetById

func (client *VKClient) GroupGetById(groupId int) (*Group, error)

func (*VKClient) GroupGetByIds

func (client *VKClient) GroupGetByIds(groupIds []int) ([]*Group, error)

func (*VKClient) GroupGetMembers

func (client *VKClient) GroupGetMembers(group_id int, count int) (int, []*User, error)

func (*VKClient) GroupSearch

func (client *VKClient) GroupSearch(query string, count int) (int, []*Group, error)

func (*VKClient) GroupSendInvite

func (client *VKClient) GroupSendInvite(groupID int, userID int) error

func (*VKClient) LikesGet

func (client *VKClient) LikesGet(itemType string, ownerID int, itemID int, count int, params url.Values) (int, []*LikeUser, error)

func (*VKClient) ListenLongPollServer

func (client *VKClient) ListenLongPollServer()

func (*VKClient) ListenLongPollServerWithCancel

func (client *VKClient) ListenLongPollServerWithCancel(cancelCtx context.Context)

func (*VKClient) MakeRequest

func (client *VKClient) MakeRequest(method string, params url.Values) (APIResponse, error)

func (*VKClient) MessagesDelete

func (client *VKClient) MessagesDelete(ids []int, spam int, deleteForAll int) (int, error)

func (*VKClient) MessagesGet

func (client *VKClient) MessagesGet(count int, chatID int, isDialog bool, params url.Values) (int, []*DialogMessage, error)

func (*VKClient) MessagesGetByID

func (client *VKClient) MessagesGetByID(message_ids []int, params url.Values) (int, []*DialogMessage, error)

func (*VKClient) MessagesSend

func (client *VKClient) MessagesSend(peerOrDomain interface{}, message string, params url.Values) (APIResponse, error)

func (*VKClient) MessagesSetActivity

func (client *VKClient) MessagesSetActivity(user int, params url.Values) error

func (*VKClient) PhotosGetById

func (client *VKClient) PhotosGetById(photos []string) ([]*Photo, error)

func (*VKClient) ResolveScreenName

func (client *VKClient) ResolveScreenName(name string) (ResolveScreenName, error)

func (*VKClient) UploadGroupWallDoc

func (client *VKClient) UploadGroupWallDoc(groupID int, fileName string) (*DocAttachment, error)

func (*VKClient) UploadGroupWallPhotos

func (client *VKClient) UploadGroupWallPhotos(groupID int, files []string) ([]*PhotoAttachment, error)

func (*VKClient) UploadMessagesPhotos

func (client *VKClient) UploadMessagesPhotos(peerID int, files []string) ([]*PhotoAttachment, error)

func (*VKClient) UsersGet

func (client *VKClient) UsersGet(users []int) ([]*User, error)

func (*VKClient) WallGet

func (client *VKClient) WallGet(id interface{}, count int, params url.Values) (*Wall, error)

func (*VKClient) WallGet1000

func (client *VKClient) WallGet1000(ownerId int, offset int) (*Wall, error)

func (*VKClient) WallGetByID

func (client *VKClient) WallGetByID(id string, params url.Values) (*Wall, error)

func (*VKClient) WallPost

func (client *VKClient) WallPost(ownerID int, message string, params url.Values) (int, error)

func (*VKClient) WallPostComment

func (client *VKClient) WallPostComment(ownerID int, postID int, message string, params url.Values) (int, error)

type VKGroupBot

type VKGroupBot struct {
	VKClient
	Group
	// contains filtered or unexported fields
}

func NewVKGroupBot

func NewVKGroupBot(token string, options *TokenOptions) (*VKGroupBot, error)

func (*VKGroupBot) AddBotsLongpollCallback

func (client *VKGroupBot) AddBotsLongpollCallback(name string, f func(*BotsLongPollObject))

func (*VKGroupBot) DeleteBotsLongpollCallback

func (client *VKGroupBot) DeleteBotsLongpollCallback(name string)

func (*VKGroupBot) ListenBotsLongPollServer

func (client *VKGroupBot) ListenBotsLongPollServer()

func (*VKGroupBot) ListenBotsLongPollServerWithCancel

func (client *VKGroupBot) ListenBotsLongPollServerWithCancel(cancelCtx context.Context)

type VideoAttachment

type VideoAttachment struct {
	ID            int    `json:"id"`
	OwnerID       int    `json:"owner_id"`
	Title         string `json:"title"`
	Duration      int    `json:"duration"`
	Description   string `json:"description"`
	Date          int64  `json:"date"`
	AddingDate    int64  `json:"adding_date"`
	Views         int    `json:"views"`
	Width         int    `json:"width"`
	Height        int    `json:"height"`
	Photo130      string `json:"photo130"`
	Photo320      string `json:"photo320"`
	Photo800      string `json:"photo800"`
	FirstFrame320 string `json:"first_frame_320"`
	FirstFrame160 string `json:"first_frame_160"`
	FirstFrame130 string `json:"first_frame_130"`
	FirstFrame800 string `json:"first_frame_800"`
	Player        string `json:"player"`
	CanEdit       int    `json:"can_edit"`
	CanAdd        int    `json:"can_add"`
}

type Wall

type Wall struct {
	Count    int         `json:"count"`
	Posts    []*WallPost `json:"items"`
	Profiles []*User     `json:"profiles"`
	Groups   []*Group    `json:"groups"`
}

type WallPost

type WallPost struct {
	ID           int                  `json:"id"`
	FromID       int                  `json:"from_id"`
	OwnerID      int                  `json:"owner_id"`
	ToID         int                  `json:"to_id"`
	Date         int64                `json:"date"`
	MarkedAsAd   int                  `json:"marked_as_ads"`
	IsPinned     int                  `json:"is_pinned"`
	PostType     string               `json:"post_type"`
	CopyPostDate int64                `json:"copy_post_date"`
	CopyPostType string               `json:"copy_post_type"`
	CopyOwnerID  int                  `json:"copy_owner_id"`
	CopyPostID   int                  `json:"copy_post_id"`
	CopyHistory  []*WallPost          `json:"copy_history"`
	CreatedBy    int                  `json:"created_by"`
	Text         string               `json:"text"`
	CanDelete    int                  `json:"can_delete"`
	CanPin       int                  `json:"can_pin"`
	Attachments  []*MessageAttachment `json:"attachments"`
	PostSource   *Source              `json:"post_source"`
	Comments     *Comment             `json:"comments"`
	Likes        *Like                `json:"likes"`
	Reposts      *Repost              `json:"reposts"`
	Online       int                  `json:"online"`
	ReplyCount   int                  `json:"reply_count"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL