@adwatch/socmechanics-factory
v1.0.4
Published
Factory of social mechanics
Downloads
6
Readme
#SocMechanicsFactory
Install
$ npm install --save @adwatch/socmechanics-factory
Usage
import SocMechanicsFactory from '@adwatch/socmechanics-factory';
// or
var SocMechanicsFactory = require('@adwatch/form/build');
//or you can use separate Social Network
import {SocMechanicsVK,
SocMechanicsFB,
SocMechanicsOK,
SocMechanicsTW,
SocMechanicsIN} from '@adwatch/socmechanics-factory';
API - SocMechanicsFactory
Initialize SocMechanicsFactory
const socMechanicsFactory = new SocMechanicsFactory();
####produce(type, config)
Initialize SocMechanicsFactory
socMechanicsFactory.produce('VK', {appId: 5878932});
API - SocMechanics[VK,FB,OK,TW,IN]
For instance VK type
Initialize SocMechanicsVK
const socMechanicsVK = new SocMechanicsVK({appId: 5878932});
####init()
Initialization
Allowed for all networks
socMechanicsVK.init();
####getUserAuth()
Get user Auth data
This method must be use at first.
Allowed for all networks
Return Promise
socMechanicsVK.getUserAuth();
####getUserInfo()
Get Main info of user
Only (VK,FB,OK)
Return Promise
socMechanicsVK.getUserInfo();
####getUserAvatar()
Get Avatar Profile of user
Allowed for all networks
Return Promise
socMechanicsVK.getUserAvatar();
####getUserPost()
Get User Posts
Only (VK,FB,OK)
Return Promise
socMechanicsVK.getUserPost();
####getLastPost(key)
Get Last post from cache
Only (VK,FB,OK)
socMechanicsVK.getLastPost('timeStamp');
####makePackage(CASE)
Make package with filtered data
About CASEs you can follow to https://www.npmjs.com/package/@adwatch/socmechanics-adapter
Allowed for all networks
socMechanicsVK.makePackage('freeShare:onePost:allNetworks');
####checkWallPost(config)
Check conformity last post data with your config data
You can to see most common information to https://www.npmjs.com/package/@adwatch/share
Only (VK,FB,OK)
Return true/false
socMechanicsVK.checkWallPost({
description: 'Test page desc',
img: 'http://example.ru/img/share.jpg',
title: 'Test Share',
url: window.location.href,
workId: 2
});
License
MIT ©