Documentation ¶
Index ¶
- Constants
- func Auth(accessToken string) (*Client, *Error)
- type Args
- type ArgsMap
- type AudioMessage
- type ChatID
- type Client
- func (c *Client) Do(req *http.Request, obj interface{}) (status int, canceled bool)
- func (c *Client) EditMessage(peerID ID, convMessageID int, content OutMessageContent) (bool, *Error)
- func (c *Client) GetConversationMembers(peerID ID) (*Members, *Error)
- func (c *Client) GetLongPollServer(groupID GroupID) (*LongPollServer, *Error)
- func (c *Client) GroupsGetByID(groupIds ...GroupID) ([]*Group, *Error)
- func (c *Client) HTTP(req *http.Request) (*http.Response, error)
- func (c *Client) PhotosGetMessagesUploadServer(peerID ID) (*MessagesUploadServer, *Error)
- func (c *Client) PhotosSaveMessagesPhoto(server int, photo, hash string) ([]*Photo, *Error)
- func (c *Client) RemoveChatUser(chatID ChatID, memberID ID) *Error
- func (c *Client) Self() Group
- func (c *Client) SendMessage(msg OutMessage) *Error
- func (c *Client) SendMessageEventAnswer(eventID string, userID UserID, peerID ID, eventData *EventData) *Error
- func (c *Client) UsersGet(userIds []UserID, nameCase string, fields ...string) ([]*User, *Error)
- type Error
- type EventData
- type Group
- type GroupID
- type ID
- type JSONData
- type LongPollServer
- type Member
- type Members
- type Message
- type MessagesUploadServer
- type OutMessage
- type OutMessageContent
- type Photo
- type User
- type UserID
Constants ¶
const ( AttachmentTypePhoto = "photo" AttachmentTypeAudioMessage = "audio_message" )
vk types
const ( EventDataTypeShowSnackbar = "show_snackbar" EventDataTypeOpenLink = "open_link" EventDataTypeOpenApp = "open_app" )
const ( UserNameCaseNom = "nom" UserNameCaseGen = "gen" UserNameCaseDat = "dat" UserNameCaseAcc = "acc" UserNameCaseIns = "ins" UserNameCaseAbl = "abl" )
name cases
const ( UserOptFieldPhoto50 = "photo_50" UserOptFieldPhoto100 = "photo_100" UserOptFieldPhoto200 = "photo_200" UserOptFieldPhotoMax = "photo_max" UserOptFieldPhoto200Orig = "photo_200_orig" UserOptFieldPhoto400Orig = "photo_400_orig" UserOptFieldPhotoMaxOrig = "photo_max_orig" UserOptFieldOnline = "online" UserOptFieldScreenName = "screen_name" )
users opt fields
const Version = "5.120"
Version is a vk api version.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AudioMessage ¶
type AudioMessage struct { Duration int `json:"duration"` LinkOGG string `json:"link_ogg"` LinkMP3 string `json:"link_mp3"` // contains filtered or unexported fields }
AudioMessage struct.
func (*AudioMessage) String ¶
func (a *AudioMessage) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct.
func (*Client) EditMessage ¶
func (c *Client) EditMessage(peerID ID, convMessageID int, content OutMessageContent) (bool, *Error)
EditMessage edits a message.
func (*Client) GetConversationMembers ¶
GetConversationMembers returns a list of IDs of users participating in a conversation.
func (*Client) GetLongPollServer ¶
func (c *Client) GetLongPollServer(groupID GroupID) (*LongPollServer, *Error)
GetLongPollServer returns the data needed to query a Long Poll server for events.
func (*Client) GroupsGetByID ¶
GroupsGetByID returns information about communities by their IDs.
func (*Client) PhotosGetMessagesUploadServer ¶
func (c *Client) PhotosGetMessagesUploadServer(peerID ID) (*MessagesUploadServer, *Error)
PhotosGetMessagesUploadServer returns the server address for photo upload in a private message for a user. When uploaded successfully, the photo can be saved using the photos.saveMessagesPhoto method.
func (*Client) PhotosSaveMessagesPhoto ¶
PhotosSaveMessagesPhoto saves a photo after being successfully uploaded. URL obtained with photos.getMessagesUploadServer method.
func (*Client) RemoveChatUser ¶
RemoveChatUser allows the current user to leave a chat or, if the current user started the chat, allows the user to remove another user from the chat.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(msg OutMessage) *Error
SendMessage sends a message.
type EventData ¶
type EventData struct { Type string `json:"type"` // show_snackbar Text string `json:"text,omitempty"` // open_link Link string `json:"link,omitempty"` // open_app Hash string `json:"hash,omitempty"` AppID int `json:"app_id,omitempty"` OwnerID int `json:"owner_id,omitempty"` }
EventData struct.
type Group ¶
type Group struct { Name string `json:"name"` ScreenName string `json:"screen_name"` Type string `json:"type"` ID GroupID `json:"id"` IsClosed boolean `json:"is_closed"` Deactivated string `json:"deactivated"` Photo50 string `json:"photo_50"` Photo100 string `json:"photo_100"` Photo200 string `json:"photo_200"` }
Group describes VK community.
type JSONData ¶
type JSONData string
JSONData represents json as string.
func NewJSONData ¶
NewJSONData creates new JSONData from object.
func (*JSONData) UnmarshalJSON ¶
UnmarshalJSON implementation.
type LongPollServer ¶
type LongPollServer struct { Server string `json:"server"` Key string `json:"key"` Ts string `json:"ts"` }
LongPollServer struct.
type Member ¶
type Member struct { MemberID ID `json:"member_id"` InvitedBy ID `json:"invited_by"` JoinDate int64 `json:"join_date"` IsAdmin bool `json:"is_admin"` IsOwner bool `json:"is_owner"` CanKick bool `json:"can_kick"` }
Member struct.
type Members ¶
type Members struct { Items []*Member `json:"items"` Profiles []*User `json:"profiles"` Groups []*Group `json:"groups"` Count int `json:"count"` }
Members struct.
type Message ¶
type Message struct { Date int64 `json:"date"` FromID ID `json:"from_id"` PeerID ID `json:"peer_id"` Text string `json:"text"` Attachments []attachment `json:"attachments"` Forward []shortMsg `json:"fwd_messages"` Reply *shortMsg `json:"reply_message"` Payload JSONData `json:"payload"` ConvMessageID int `json:"conversation_message_id"` Action *struct { Type string `json:"type"` MemberID int `json:"member_id"` } `json:"action"` }
Message struct.
type MessagesUploadServer ¶
type MessagesUploadServer struct { UploadURL string `json:"upload_url"` AlbumID int `json:"album_id"` UserID UserID `json:"user_id"` }
MessagesUploadServer struct.
type OutMessage ¶
type OutMessage struct { UserID UserID `vkargs:"user_id"` UserIDs []UserID `vkargs:"user_ids"` PeerID ID `vkargs:"peer_id"` PeerIDs []ID `vkargs:"peer_ids"` Domain string `vkargs:"domain"` ChatID ChatID `vkargs:"chat_id"` OutMessageContent // contains filtered or unexported fields }
OutMessage struct.
type OutMessageContent ¶
type OutMessageContent struct { Message string `vkargs:"message"` Lat float64 `vkargs:"lat"` Long float64 `vkargs:"long"` Attachment []string `vkargs:"attachment"` StickerID int `vkargs:"sticker_id"` Keyboard JSONData `vkargs:"keyboard"` ReplyTo int `vkargs:"reply_to"` ForwardMessages []int `vkargs:"forward_messages"` DontParseLinks bool `vkargs:"dont_parse_links"` DisableMentions bool `vkargs:"disable_mentions"` }
OutMessageContent struct.
type Photo ¶
type Photo struct { AlbumID int `json:"album_id"` UserID UserID `json:"user_id"` Date int64 `json:"date"` HasTag bool `json:"has_tag"` Text string `json:"text"` Sizes []struct { URL string `json:"url"` Type string `json:"type"` Height int `json:"height"` Width int `json:"width"` } `json:"sizes"` // contains filtered or unexported fields }
Photo struct.
type User ¶
type User struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` ID UserID `json:"id"` Deactivated string `json:"deactivated"` IsClosed boolean `json:"is_closed"` CanAccessClosed bool `json:"can_access_closed"` // opt fields 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"` Online *boolean `json:"online"` ScreenName *string `json:"screen_name"` }
User struct.