easyvk

package
v0.0.0-...-1edff12 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package easyvk provides you simple way to work with VK API.

Index

Constants

View Source
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

func NewKeyboardBuilder

func NewKeyboardBuilder() *keyboardBuilder

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

func (a *Account) BanUser(userID uint) (bool, error)

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

func (a *Account) SetOffline() (bool, error)

SetOffline marks a current user as offline. https://vk.com/dev/account.setOffline

func (*Account) SetOnline

func (a *Account) SetOnline(voip bool) (bool, error)

SetOnline marks a current user as online for 5 minutes. https://vk.com/dev/account.setOnline

func (*Account) UnbanUser

func (a *Account) UnbanUser(userID uint) (bool, error)

UnbanUser deletes user from the blacklist. https://vk.com/dev/account.unbanUser

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 AttachmentMObject

type AttachmentMObject struct {
	Type  TypeAttachmentM `json:"type"`
	Photo PhotoObject     `json:"photo"`
}

A AttachmentMObject contains information about attachments_m. https://vk.com/dev/objects/attachments_m

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

func (b *Board) CloseTopic(groupID, topicID uint) (bool, error)

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

func (b *Board) DeleteTopic(groupID, topicID uint) (bool, error)

DeleteTopic deletes a topic from a community's discussion board. https://vk.com/dev/board.deleteTopic

func (*Board) EditTopic

func (b *Board) EditTopic(groupID, topicID uint, title string) (bool, error)

EditTopic edits the title of a topic on a community's discussion board. https://vk.com/dev/board.editTopic

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 CityObject

type CityObject struct {
	ID        int    `json:"id"`
	Title     string `json:"title"`
	Important bool   `json:"important"`
}

A GroupObject contains information about city. https://vk.com/dev/objects/group

type ConversationObject

type ConversationObject struct {
	Peer struct {
		ID      int    `json:"id"`
		Type    string `json:"type"`
		LocalID int    `json:"local_id"`
	} `json:"peer"`
	InRead      int  `json:"in_read"`
	OutRead     int  `json:"out_read"`
	UnreadCount int  `json:"unread_count"`
	Important   bool `json:"important"`
	Unanswered  bool `json:"unanswered"`
	CanWrite    struct {
		Allowed bool `json:"allowed"`
		Reason  int  `json:"reason"`
	} `json:"can_write"`
	ChatSettings struct {
		MembersCount  int         `json:"members_count"`
		Title         int         `json:"title"`
		PinnedMessage interface{} `json:"pinned_message"`
		State         string      `json:"state"`
		Photo         struct {
			Photo50  string `json:"photo_50"`
			Photo100 string `json:"photo_100"`
			Photo200 string `json:"photo_200"`
		} `json:"photo"`
		ActiveIDs      []int `json:"active_ids"`
		IsGroupChannel bool  `json:"is_group_channel"`
	} `json:"chat_settings"`
}

A ConversationObject contains information about conversation. https://vk.com/dev/objects/conversation

type Database

type Database struct {
	// contains filtered or unexported fields
}

These methods provide access to VK's database of educational institutions. Access to data is free and authorization is not required, but the number of requests from one IP address can be limited. If you need to execute many requests, we recommend that you call these methods from the client side using JSONP. https://vk.com/dev/database

func (*Database) GetCities

Returns a list of cities. https://vk.com/dev/database.getCities

type DatabaseGetCitiesParams

type DatabaseGetCitiesParams struct {
	CountryId uint
	RegionId  uint
	Query     string
	NeedAll   bool
	Offset    uint
	Count     uint
}

DatabaseGetCitiesParams provides structure for parameters for get method. https://vk.com/dev/database.getCities

type DatabaseGetCitiesResponse

type DatabaseGetCitiesResponse struct {
	Count int
	Items []CityObject
}

DatabaseGetCitiesResponse describes https://vk.com/dev/database.getCities

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

func (*Error) Error

func (e *Error) Error() string

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 (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 Friends

type Friends struct {
	// contains filtered or unexported fields
}

Methods for working with friends. https://vk.com/dev/friends

func (*Friends) Get

Returns a list of user IDs or detailed information about a user's friends. https://vk.com/dev/friends.get

type FriendsGetParams

type FriendsGetParams struct {
	UserID uint
	Order  string
	Count  uint
	Offset uint
}

UsersGetParams provides structure for parameters for get method. Returns only ids. https://vk.com/dev/friends.get

type FriendsGetResponse

type FriendsGetResponse struct {
	Count int
	Items []uint
}

PhotosGetResponse describes https://vk.com/dev/photos.get

type GetByIdParams

type GetByIdParams struct {
	MessageIDs    string
	PreviewLength int
	Extended      bool
	Fields        string
	GroupId       uint
}

GetByIdParams provides structure for parameters for get method. https://vk.com/dev/messages.getById

type GetByIdResponse

type GetByIdResponse struct {
	Count int
	Items []MessageObject
}

GetByIdResponse describes https://vk.com/dev/messages.getById

type GetConversationsParams

type GetConversationsParams struct {
	Offset         int
	Count          int
	Filter         TypeFilter
	Extended       bool
	StartMessageId int
	Fields         string
	GroupId        uint
	MajorSortId    uint
}

https://vk.com/dev/messages.getConversations

type GetConversationsResponse

type GetConversationsResponse struct {
	Count int `json:"count"`
	Items []struct {
		MessageObject      MessageObject      `json:"last_message"`
		ConversationObject ConversationObject `json:"conversation"`
	}
	UnreadCount int `json:"unread_count"`
}

https://vk.com/dev/messages.getConversations

type GetHistoryParams

type GetHistoryParams struct {
	Offset         int
	Count          int
	UserId         int
	PeerId         int
	StartMessageId int
	Rev            bool
	Extended       bool
	Fields         string
	GroupId        uint
}

GetHistoryParams provides structure for parameters for get method. https://vk.com/dev/messages.getHistory

type GetHistoryResponse

type GetHistoryResponse struct {
	Count int
	Items []MessageObject
}

GetHistoryResponse describes https://vk.com/dev/messages.getHistory

type GroupObject

type GroupObject struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	ScreenName   string `json:"screen_name"`
	IsClosed     int    `json:"is_closed"`
	Type         string `json:"type"`
	IsAdmin      int    `json:"is_admin"`
	IsMember     int    `json:"is_member"`
	IsAdvertiser int    `json:"is_advertiser"`
	Photo50      string `json:"photo_50"`
	Photo100     string `json:"photo_100"`
	Photo200     string `json:"photo_200"`
}

A GroupObject contains information about group. https://vk.com/dev/objects/group

type Groups

type Groups struct {
	// contains filtered or unexported fields
}

Methods for working with groups. https://vk.com/dev/groups

func (*Groups) GetByID

func (g *Groups) GetByID(par GroupsGetParams) ([]GroupObject, error)

Returns information about communities by their IDs. https://vk.com/dev/groups.getById

type GroupsGetParams

type GroupsGetParams struct {
	GroupIDs string
	GroupID  string
	Fields   string
}

GroupsGetParams provides structure for parameters for get method. https://vk.com/dev/groups.getById

type GroupsGetResponse

type GroupsGetResponse struct {
	Count int
	Items []uint
}

GroupsGetResponse describes https://vk.com/dev/groups.getById

type Keyboard

type Keyboard struct {
	OneTime bool               `json:"one_time"`
	Buttons [][]KeyboardButton `json:"buttons"`
}

type KeyboardButton

type KeyboardButton struct {
	Action KeyboardButtonAction `json:"action"`
	Color  KeyboardButtonColor  `json:"color"`
}

type KeyboardButtonAction

type KeyboardButtonAction struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
	Label   string `json:"label"`
}

type KeyboardButtonColor

type KeyboardButtonColor string
const KeyboardButtonColorDefault KeyboardButtonColor = "default"
const KeyboardButtonColorNegative KeyboardButtonColor = "negative"
const KeyboardButtonColorPositive KeyboardButtonColor = "positive"
const KeyboardButtonColorPrimary KeyboardButtonColor = "primary"

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

func (l *Likes) Add(t likeType, ownerID int, itemID uint, accessKey string) (int, error)

Add adds the specified object to the Likes list of the current user. https://vk.com/dev/likes.add

func (*Likes) Delete

func (l *Likes) Delete(t likeType, ownerID int, itemID uint) (int, error)

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

type LikesIsLikedResponse struct {
	Liked  bool
	Copied bool
}

LikesIsLikedResponse describes info about like and repost. https://vk.com/dev/likes.isLiked

type MessageObject

type MessageObject struct {
	ID                    int                 `json:"id"`
	Date                  int                 `json:"date"`
	PeerID                int                 `json:"peer_id"`
	FromID                int                 `json:"from_id"`
	Text                  string              `json:"text"`
	RandomID              int64               `json:"random_id"`
	Ref                   string              `json:"ref"`
	RefSource             string              `json:"ref_source"`
	Attachments           []AttachmentMObject `json:"attachments"`
	Important             bool                `json:"important"`
	Payload               string              `json:"payload"`
	Out                   int                 `json:"out"`
	ConversationMessageID int                 `json:"conversation_message_id"`
	FwdMessages           []interface{}       `json:"fwd_messages"`
	IsHidden              bool                `json:"is_hidden"`
}

A MessageObject contains information about message. https://vk.com/dev/objects/message

type Messages

type Messages struct {
	// contains filtered or unexported fields
}

Methods for send messages. https://vk.com/dev/messages

func (*Messages) GetById

func (m *Messages) GetById(par GetByIdParams) (GetByIdResponse, error)

Returns messages by their IDs. https://vk.com/dev/messages.getById

func (*Messages) GetHistory

func (m *Messages) GetHistory(par GetHistoryParams) (GetHistoryResponse, error)

Returns message history for the specified user or group chat. https://vk.com/dev/messages.getHistory

func (*Messages) Send

func (m *Messages) Send(par MessagesSendParams) (uint, error)

Returns a list of user IDs or detailed information about a user's friends. https://vk.com/dev/messages.send

func (*Messages) SetActivity

func (m *Messages) SetActivity(par MessagesSetActivityParams) (uint, error)

Changes the status of a user as typing in a conversation. https://vk.com/dev/messages.setActivity

type MessagesSendParams

type MessagesSendParams struct {
	UserID          uint
	RandomID        int64
	PeerID          int
	Domain          string
	ChatId          uint
	UserIDs         string
	Message         string
	Lat             float32
	Long            float32
	Attachment      string
	ReplyTo         int
	ForwardMessages string
	StickerId       uint
	GroupId         uint
	Keyboard        *Keyboard
	Payload         string
}

MessagesSendParams provides structure for parameters for get method. Returns only ids. https://vk.com/dev/messages.send

type MessagesSetActivityParams

type MessagesSetActivityParams struct {
	UserID  uint
	Type    TypeActivity
	PeerID  int
	GroupId uint
}

MessagesSetActivityParams provides structure for parameters for get method. https://vk.com/dev/messages.setActivity

type Notifications

type Notifications struct {
	// contains filtered or unexported fields
}

Methods for working with notifications. https://vk.com/dev/notifications

func (*Notifications) SendMessage

func (n *Notifications) SendMessage(userIDs, message, fragment string) error

Returns a list of notifications about other users' feedback to the current user's wall posts. https://vk.com/dev/notifications.sendMessage

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 {
		Url    string `json:"url"`
		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) Get

Returns a list of a user's or community's photos. https://vk.com/dev/photos.get

func (*Photos) GetMessagesUploadServer

func (p *Photos) GetMessagesUploadServer(peerId uint) (PhotosGetMessagesUploadServerResponse, error)

GetMessagesUploadServer returns the server address for photo upload onto a message. https://vk.com/dev/photos.getMessagesUploadServer

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) SaveMessagesPhoto

func (p *Photos) SaveMessagesPhoto(photo string, server int, hash string) ([]PhotoObject, error)

SaveMessagesPhoto saves a photo. For upload look at file upload.go. https://vk.com/dev/photos.saveMessagesPhoto

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 PhotosGetFollowersResponse

type PhotosGetFollowersResponse struct {
	Count int
	Items []UserObject
}

PhotosGetResponse describes https://vk.com/dev/photos.get

type PhotosGetMessagesUploadServerResponse

type PhotosGetMessagesUploadServerResponse struct {
	UploadURL string `json:"upload_url"`
	AlbumID   int    `json:"album_id"`
	UserID    int    `json:"user_id"`
}

PhotosGetMessagesUploadServerResponse describes the server address for photo upload onto a message. https://vk.com/dev/photos.getMessagesUploadServer

type PhotosGetParams

type PhotosGetParams struct {
	OwnerID  uint
	AlbumID  string
	PhotoIDs string
	Rev      bool
	Offset   int
	Count    int
}

PhotosGetParams provides structure for parameters for Get method. https://vk.com/dev/photos.get

type PhotosGetResponse

type PhotosGetResponse struct {
	Count int
	Items []PhotoObject
}

PhotosGetResponse describes https://vk.com/dev/photos.get

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

func (s *Status) Get(id int) (string, error)

Get returns data required to show the status of a user or community https://vk.com/dev/status.get

func (*Status) Set

func (s *Status) Set(text string, id int) (bool, error)

Set a new status for the current user https://vk.com/dev/status.set

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Methods for working with friends. https://vk.com/dev/storage

func (*Storage) Get

func (f *Storage) Get(userId uint32, key string) (string, error)

Returns a value of variable with the name set by key parameter. https://vk.com/dev/storage.get

func (*Storage) Set

func (f *Storage) Set(userId uint32, key, value string) error

Returns a value of variable with the name set by key parameter. https://vk.com/dev/storage.set

type TypeActivity

type TypeActivity string
const TypeActivityAudio TypeActivity = "audiomessage"
const TypeActivityTyping TypeActivity = "typing"

type TypeAttachmentM

type TypeAttachmentM string
const TypeAttachmentMAudio TypeAttachmentM = "audio"
const TypeAttachmentMDoc TypeAttachmentM = "doc"
const TypeAttachmentMGift TypeAttachmentM = "gift"
const TypeAttachmentMLink TypeAttachmentM = "link"
const TypeAttachmentMMarket TypeAttachmentM = "market"
const TypeAttachmentMMarketAlbum TypeAttachmentM = "market_album"
const TypeAttachmentMPhoto TypeAttachmentM = "photo"
const TypeAttachmentMSticker TypeAttachmentM = "sticker"
const TypeAttachmentMVideo TypeAttachmentM = "video"
const TypeAttachmentMWall TypeAttachmentM = "wall"
const TypeAttachmentMWallReply TypeAttachmentM = "wall_reply"

type TypeFilter

type TypeFilter string
const (
	TypeFilterAll        TypeFilter = "all"
	TypeFilterUnread     TypeFilter = "unread"
	TypeFilterImportant  TypeFilter = "important"
	TypeFilterUnanswered TypeFilter = "unanswered"
)

type Upload

type Upload struct{}

An Upload describes a set of methods that helps with update to VK servers.

func (*Upload) Photo

func (u *Upload) Photo(url, filePath string) (UploadPhotoResponse, error)

Photo upload file (on filePath) to given url. Return info about uploaded photo.

func (*Upload) PhotoFromUrl

func (u *Upload) PhotoFromUrl(url, photoUrl string) (UploadPhotoResponse, error)

Photo upload file (on filePath) to given url. Return info about uploaded photo.

func (*Upload) PhotoWall

func (u *Upload) PhotoWall(url, filePath string) (UploadPhotoResponse, error)

PhotoWall upload file (on filePath) to given url. Return info about uploaded photo.

type UploadPhotoResponse

type UploadPhotoResponse struct {
	Server int    `json:"server"`
	Photo  string `json:"photo"`
	Hash   string `json:"hash"`
}

A UploadResponse describes an info about uploaded photo.

type UserObject

type UserObject struct {
	ID         uint   `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           []struct {
		GroupID   int    `json:"group_id"`
		Company   string `json:"company"`
		CountryId int    `json:"country_id"`
		CityId    int    `json:"city_id"`
		CityName  string `json:"city_name"`
		From      int    `json:"from"`
		Until     int    `json:"until"`
		Position  string `json:"position"`
	} `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 []struct {
		ID              int    `json:"id"`
		Country         int    `json:"country"`
		City            int    `json:"city"`
		Name            string `json:"name"`
		Faculty         int    `json:"faculty"`
		FacultyName     string `json:"faculty_name"`
		Chair           int    `json:"chair"`
		ChairName       string `json:"chair_name"`
		Graduation      int    `json:"graduation"`
		EducationForm   string `json:"education_form"`
		EducationStatus string `json:"education_status"`
	} `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 Users

type Users struct {
	// contains filtered or unexported fields
}

A Users describes a set of methods to work with user. https://vk.com/dev/users

func (*Users) Get

func (u *Users) Get(par UsersGetParams) ([]UserObject, error)

Returns detailed information on users. https://vk.com/dev/users.get

func (*Users) GetFollowers

Returns a list of IDs of followers of the user in question, sorted by date added, most recent first. https://vk.com/dev/users.getFollowers

type UsersGetFollowersParams

type UsersGetFollowersParams struct {
	UserID   uint
	Offset   int
	Count    int
	Fields   string
	NameCase string
}

UsersGetParams provides structure for parameters for get method. https://vk.com/dev/users.getFollowers

type UsersGetParams

type UsersGetParams struct {
	UserIDs  string
	Fields   string
	NameCase string
}

UsersGetParams provides structure for parameters for get method. https://vk.com/dev/users.get

type VK

type VK struct {
	AccessToken   string
	Version       string
	Account       Account
	Board         Board
	Database      Database
	Fave          Fave
	Friends       Friends
	Groups        Groups
	Likes         Likes
	Messages      Messages
	Notifications Notifications
	Photos        Photos
	Status        Status
	Storage       Storage
	Upload        Upload
	Users         Users
	Wall          Wall
}

VK defines a set of functions for working with VK API.

func WithAuth

func WithAuth(login, password, clientID, scope string) (VK, error)

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"

func WithClientFlow

func WithClientFlow(clientID, clientSecret string) (VK, error)

func WithToken

func WithToken(token string) VK

WithToken helps to initialize your VK object with token.

func (*VK) Request

func (vk *VK) Request(method string, params map[string]string) (data []byte, err error)

Request provides access to VK API methods.

func (*VK) RequestAttempt

func (vk *VK) RequestAttempt(method string, params map[string]string) ([]byte, error)

Request provides access to VK API methods.

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

Jump to

Keyboard shortcuts

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