All Projects → Vorkytaka → easyvk-go

Vorkytaka / easyvk-go

Licence: Apache-2.0 license
Simple way to work with VK API

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to easyvk-go

Vkb
Bot for vk.com competitions
Stars: ✭ 24 (-48.94%)
Mutual labels:  vk, vkontakte, vk-api
Swiftyvk
Easy and powerful way to interact with VK API for iOS and macOS
Stars: ✭ 247 (+425.53%)
Mutual labels:  vk, vkontakte, vk-api
Vk.py
Extremely-fast, easy-to-use, [not] ready for production. The asyncio based library for Python and Humans written to be efficient and reliable. [Unmaintained]
Stars: ✭ 38 (-19.15%)
Mutual labels:  vk, vkontakte, vk-api
InTouch
👥 InTouch - is a programming SDK build around vk.com API exposing most of the social platform features including messaging, news feed fetching, communities, and media management.
Stars: ✭ 33 (-29.79%)
Mutual labels:  vk, vkontakte, vk-api
vk-api
VK SDK | VKontakte wrapper for standalone apps
Stars: ✭ 30 (-36.17%)
Mutual labels:  vk, vkontakte, vk-api
vk-mini-app-boilerplate
Стартовый кит для создания сервиса на платформе VK Mini Apps с использованием React + Redux
Stars: ✭ 61 (+29.79%)
Mutual labels:  vk, vkontakte, vk-api
Vk Requests
vk.com requests for humans. API library for vk.com
Stars: ✭ 162 (+244.68%)
Mutual labels:  vk, vkontakte, vk-api
VK-Scraper
Scrapes VK user's photos
Stars: ✭ 42 (-10.64%)
Mutual labels:  vk, vkontakte, vk-api
Sketal
Бот для ВКонтакте. Беседы / группы / развлечения.
Stars: ✭ 119 (+153.19%)
Mutual labels:  vk, vkontakte, vk-api
Vk To Telegram Bot
Bot for auto-reposting posts from VK to Telegram channel
Stars: ✭ 103 (+119.15%)
Mutual labels:  vk, vkontakte, vk-api
VideoforVk
Video for Vk (or VT) is client for Vk video API.
Stars: ✭ 27 (-42.55%)
Mutual labels:  vk, vkontakte, vk-api
py-vkontakte
A Python wrapper around the vk.com
Stars: ✭ 17 (-63.83%)
Mutual labels:  vk, vkontakte, vk-api
Node Vk Bot Api
🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API.
Stars: ✭ 195 (+314.89%)
Mutual labels:  vk, vkontakte, vk-api
vbio
Python модуль для написания скриптов, использующих Bots API для социальной сети Вконтакте (vk.com)
Stars: ✭ 10 (-78.72%)
Mutual labels:  vk, vkontakte, vk-api
kasthack.osp
Генератор сырых дампов пользователей VK.
Stars: ✭ 15 (-68.09%)
Mutual labels:  vk, vkontakte, vk-api
Vk api
Модуль для создания скриптов для ВКонтакте | vk.com API wrapper
Stars: ✭ 1,070 (+2176.6%)
Mutual labels:  vk, vkontakte, vk-api
Vkrss
Generates RSS feed of opened/closed vk.com wall or global searched opened posts. Features: post filtering (include/exclude by regexp and/or by owner type), ads skipping, automatic title generation, hash-tags extraction as RSS categories, initial author extraction, HTML formatting
Stars: ✭ 59 (+25.53%)
Mutual labels:  vk, vkontakte, vk-api
Vk Api Schema
JSON Schema of VK API
Stars: ✭ 158 (+236.17%)
Mutual labels:  vk, vkontakte, vk-api
vk-spammer
Спаммер сообщений для вк
Stars: ✭ 47 (+0%)
Mutual labels:  vk, vkontakte, vk-api
pyscrapers
Scrapers for vk, facebook, instagram and more
Stars: ✭ 18 (-61.7%)
Mutual labels:  vk, vkontakte

EasyVK GoDoc

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

Logo

Installation:

Install:

$ go get -u github.com/vorkytaka/easyvk-go/easyvk

Import:

import "github.com/vorkytaka/easyvk-go/easyvk"

How to work:

Initialize your VK object with your access token.

vk := easyvk.WithToken("token")

Or you can log in by email and password.

// put your email, password, client id and scope
// scope must be a string like "friends,wall"
vk, err := easyvk.WithAuth("[email protected]", "pa$$word", "9182736", "friends,wall,photos")
if err != nil {
	// doesn't log in
}

Now you can call method of VK API with your vk variable.

Examples:

Get user profile info:

info, err := vk.Account.GetProfileInfo()

Set user status:

// If you want to update status on your page
// then set ID to 0
userID := 0
ok, err := vk.Status.Set("New status", userID)

Post photo on wall:

id := 0

server, err := vk.Photos.GetWallUploadServer(uint(id))
if err != nil {
	log.Fatal(err)
}

// path to the image
path := "D:/x.png"
uploaded, err := vk.Upload.PhotoWall(server.UploadURL, path)
if err != nil {
	log.Fatal(err)
}

saved, err := vk.Photos.SaveWallPhoto(0, uint(id), uploaded.Photo, uploaded.Hash, "", uploaded.Server, 0, 0)
if err != nil {
	log.Fatal(err)
}

text := "Caption for the post"
photoID := "photo" + fmt.Sprint(saved[0].OwnerID) + "_" + fmt.Sprint(saved[0].ID)

params := easyvk.WallPostParams{}
params.OwnerID = id
params.Message = "Test"
params.Attachments = photoID

x, err := vk.Wall.Post(params)
if err != nil {
	log.Fatal(err)
}
fmt.Println(x)

If you need to call method that not done yet:

methodName := "account.banUser"
params := map[string]string{
        "user_id": "1",
}
byteArray, err := vk.Request(methodName, params)
if err != nil {
        
}
// Now work with byteArray.
// Parse it to struct or to interface.

Naming conventions:

API section:

Every API section must be a structure and have name as it called in API and starts with a capital letter.

For example: Account section must be type Account struct {}

API methods:

Every API method must be a method that have a received type of his section. It must have name as it called in API and starts with a capital letter.

For example: Account.banUser method must be func (a *Account) BanUser() {}

Parameters:

If method requests 4 or less parameters, then they must be just a parameters.

For example: func (a *Account) BanUser(userID uint) {}

If method requests 5 or more parameters, then he must get it with a structure. That structure must naming like [SectionName][MethodName]Params.

For example: type WallPostParams struct {}

Responses:

If method return only one field, then you must just return that field.

For example: Board.addTopic return ID of the created topic, so we just return integer.

If method return only 1 if succeeded, then we need to return boolean.

For example: Board.closeTopic return 1 is succeded, so we check if it's 1 and return true, and false otherwise.

If method return object with 2 or more fields, then we need to create a structure for that response. That structure must naming like [SectionName][MethodName]Response.

For example: type AccountGetCountersResponse struct {}

List of finished methods:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].