service

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package service implements instagram account operations and business logic.

Package service implements instagram account operations and business logic.

Package service implements instagram account operations and business logic.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLimitExceed returned when limit for action exceeded.
	ErrLimitExceed = errors.New("limit exceeded")
	// ErrCorrupted returned when instagram returned error response more than one time during loop processing.
	ErrCorrupted = errors.New("unable to continue - instagram responses with errors")
)
View Source
var ErrEmptyInput = errors.New("should not be empty")

ErrEmptyInput returned in case when user input is empty.

View Source
var ErrNoUsers = errors.New("no users")

ErrNoUsers means that no users found.

Functions

func New

func New(ctx context.Context, cfg config.Config, cfgPath string) (*Service, StopFunc, error)

New creates new instance of Service instance and returns closure func that will stop service.

Usage: svc, stop, err := New(config.Config{}) if err != nil{ // handle error } defer stop().

Types

type Service

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

Service represents service for operating instagram account.

func (*Service) Follow

func (svc *Service) Follow(user models.User) error

Follow adds user to followings.

func (*Service) GetBusinessAccountsOrBotsFromFollowers

func (svc *Service) GetBusinessAccountsOrBotsFromFollowers() ([]models.User, error)

GetBusinessAccountsOrBotsFromFollowers ranges all followers and tried to detect bots or business accounts. These accounts could be blocked as they are not useful for statistic.

func (*Service) GetDiffFollowers

func (svc *Service) GetDiffFollowers() ([]models.UsersBatch, error)

GetDiffFollowers returns batches with lost and new followers.

func (*Service) GetFollowers

func (svc *Service) GetFollowers() ([]models.User, error)

GetFollowers returns list of followers for logged in user.

func (*Service) GetFollowings

func (svc *Service) GetFollowings() ([]models.User, error)

GetFollowings returns list of followings for logged in user.

func (*Service) GetNotMutualFollowers

func (svc *Service) GetNotMutualFollowers() ([]models.User, error)

GetNotMutualFollowers returns list of users that not following back.

func (*Service) RemoveFollowersByUsername added in v0.12.0

func (svc *Service) RemoveFollowersByUsername(usernames []string) (int, error)

func (*Service) UnFollow

func (svc *Service) UnFollow(user models.User) error

UnFollow removes user from followings.

func (*Service) UnFollowAllNotMutualExceptWhitelisted

func (svc *Service) UnFollowAllNotMutualExceptWhitelisted() (int, error)

UnFollowAllNotMutualExceptWhitelisted clean followings from users that not following back except of whitelisted users.

type StopFunc

type StopFunc func()

StopFunc closure func that will stop service.

Jump to

Keyboard shortcuts

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