Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteChannel(channel *Channel) error
- func DeleteInstagram(instagram *Instagram) error
- func Init(dbstring string)
- func Stop()
- type Channel
- func CreateChannel(instagram *Instagram, c *ChannelCredentials) (*Channel, error)
- func FindActiveChannels(instagram *Instagram, action string) ([]*Channel, error)
- func FindChannels(instagram *Instagram) ([]*Channel, error)
- func GetChannel(instagram *Instagram, id int64) (*Channel, error)
- func UpdateChannel(channel *Channel, c *ChannelCredentials) (*Channel, error)
- type ChannelCredentials
- type Counters
- type Credentials
- type Hours
- type Instagram
- func CreateInstagram(user *User, c *InstagramCredentials) (*Instagram, error)
- func FindAllInstagrams() ([]*Instagram, error)
- func FindInstagrams(user *User) ([]*Instagram, error)
- func GetInstagram(user *User, id int64) (*Instagram, error)
- func UpdateInstagram(instagram *Instagram, c *InstagramCredentials) (*Instagram, error)
- func UpdateInstagramById(instagram *Instagram) (*Instagram, error)
- func (i *Instagram) ActionSpeed(action string) int
- func (i *Instagram) CheckLimits(action string) bool
- func (i *Instagram) CreateChannel(c *ChannelCredentials) (*Channel, error)
- func (i *Instagram) DeleteChannel(channel *Channel) error
- func (i *Instagram) FindActiveChannels(action string) ([]*Channel, error)
- func (i *Instagram) FindChannels() ([]*Channel, error)
- func (i *Instagram) FindLimits() *Limits
- func (i *Instagram) GetChannel(id int64) (*Channel, error)
- func (i *Instagram) IdString() string
- func (i *Instagram) Save(callback func(i *Instagram)) error
- func (i *Instagram) SyncSave(callback func(i *Instagram)) error
- func (i *Instagram) UpdateChannel(channel *Channel, c *ChannelCredentials) (*Channel, error)
- func (i *Instagram) UpdateInfo(client *instabot.Client) error
- func (i *Instagram) UpdateLimits(action string) error
- func (i *Instagram) User() (*User, error)
- func (i *Instagram) ValidateState(client *instabot.Client) error
- type InstagramCredentials
- type InstagramReadOp
- type InstagramWriteOp
- type Limits
- type Queue
- type Speed
- type User
- func (u *User) CreateInstagram(c *InstagramCredentials) (*Instagram, error)
- func (u *User) DeleteInstagram(instagram *Instagram) error
- func (u *User) FindInstagrams() ([]*Instagram, error)
- func (u *User) GetInstagram(id int64) (*Instagram, error)
- func (u *User) UpdateInstagram(instagram *Instagram, c *InstagramCredentials) (*Instagram, error)
- func (u *User) Verify(password string) bool
- type WorkersPool
Constants ¶
View Source
const CHANNEL_STATE_EMPTY = "empty"
View Source
const CHANNEL_STATE_START = "start"
View Source
const CHANNEL_STATE_STOP = "stop"
View Source
const INSTAGRAM_STATE_START = "start"
View Source
const INSTAGRAM_STATE_STOP = "stop"
View Source
const INSTAGRAM_STATE_SUSPECTED = "suspected"
Variables ¶
View Source
var ACTIONS = [4]string{
"like",
"comment",
"follow",
"unfollow",
}
View Source
var Engine *xorm.Engine
View Source
var INSTAGRAM_REGISTRY map[int64]*WorkersPool = map[int64]*WorkersPool{}
View Source
var TARGETS = [5]string{
"followers",
"subscriptions",
"hashtag",
"likes",
"comments",
}
Functions ¶
func DeleteChannel ¶
func DeleteInstagram ¶
Types ¶
type Channel ¶
type Channel struct { Id int64 `json:"id" xorm:"pk autoincr index"` InstagramId int64 `json:"-" xorm:"index"` Action string `json:"action" xorm:"varchar(250) notnull"` Target string `json:"target" xorm:"varchar(250) notnull"` Value string `json:"value" xorm:"varchar(250) notnull"` Comments []string `json:"comments" xorm:"jsonb"` State string `json:"state" xorm:"varchar(250) notnull default 'stop'"` LeadsCount int `json:"leads_count" xorm:"integer"` TargetsCount int `json:"targets_count" xorm:"integer"` FollowersCount int `json:"followers_count" xorm:"integer default 0"` Version int `json:"-" xorm:"version"` CreatedAt time.Time `json:"created_at" xorm:"created"` UpdatedAt time.Time `json:"updated_at" xorm:"updated"` *Queue `json:"-" xorm:"jsonb"` }
func CreateChannel ¶
func CreateChannel(instagram *Instagram, c *ChannelCredentials) (*Channel, error)
func FindActiveChannels ¶
func FindChannels ¶
func UpdateChannel ¶
func UpdateChannel(channel *Channel, c *ChannelCredentials) (*Channel, error)
type ChannelCredentials ¶
type Credentials ¶
type Instagram ¶
type Instagram struct { Id int64 `json:"id" xorm:"pk autoincr index"` UserId int64 `json:"-" xorm:"index"` Info *instabot.UserInfo `json:"info" xorm:"jsonb"` State string `json:"state" xorm:"varchar(250) notnull default 'stop'"` Username string `json:"username" xorm:"notnull index"` Password string `json:"password" xorm:"varchar(250) notnull"` Trusted bool `json:"trusted" xorm:"bool notnull default false"` *Hours `json:"hours" xorm:"jsonb"` *Speed `json:"speed" xorm:"jsonb"` *Counters `json:"-" xorm:"jsonb"` Version int `json:"-" xorm:"version"` CreatedAt time.Time `json:"created_at" xorm:"created"` UpdatedAt time.Time `json:"updated_at" xorm:"updated"` }
TODO: Add FollowersCount field for summary over the channels
func CreateInstagram ¶
func CreateInstagram(user *User, c *InstagramCredentials) (*Instagram, error)
func FindAllInstagrams ¶
func FindInstagrams ¶
func UpdateInstagram ¶
func UpdateInstagram(instagram *Instagram, c *InstagramCredentials) (*Instagram, error)
func UpdateInstagramById ¶
func (*Instagram) ActionSpeed ¶
func (*Instagram) CheckLimits ¶
func (*Instagram) CreateChannel ¶
func (i *Instagram) CreateChannel(c *ChannelCredentials) (*Channel, error)
func (*Instagram) DeleteChannel ¶
func (*Instagram) FindActiveChannels ¶
func (*Instagram) FindChannels ¶
func (*Instagram) FindLimits ¶
func (*Instagram) UpdateChannel ¶
func (i *Instagram) UpdateChannel(channel *Channel, c *ChannelCredentials) (*Channel, error)
func (*Instagram) UpdateLimits ¶
type InstagramCredentials ¶
type InstagramReadOp ¶
type InstagramReadOp struct {
Error error
}
type InstagramWriteOp ¶
type InstagramWriteOp struct { Instagram *Instagram Callback func(i *Instagram) ReadChannel chan *InstagramReadOp }
type User ¶
type User struct { Id int64 `json:"id" xorm:"pk autoincr index"` Username string `json:"username" xorm:"notnull index unique"` Password string `json:"-" xorm:"varchar(200) notnull"` CreatedAt time.Time `json:"created_at" xorm:"created"` UpdatedAt time.Time `json:"updated_at" xorm:"updated"` }
func CreateUser ¶
func CreateUser(c *Credentials) (*User, error)
func (*User) CreateInstagram ¶
func (u *User) CreateInstagram(c *InstagramCredentials) (*Instagram, error)
func (*User) DeleteInstagram ¶
func (*User) FindInstagrams ¶
func (*User) UpdateInstagram ¶
func (u *User) UpdateInstagram(instagram *Instagram, c *InstagramCredentials) (*Instagram, error)
type WorkersPool ¶
type WorkersPool struct { WriteOpCh chan *InstagramWriteOp InstagramCommandCh chan string StatsCommandCh chan string ChannelCommandChs map[string]chan string }
Click to show internal directories.
Click to hide internal directories.