service

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 17 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")
	// ErrNoUsers means that no users found.
	ErrNoUsers = errors.New("no users")
	// ErrEmptyInput returned in case when user input is empty.
	ErrEmptyInput = errors.New("should not be empty")
)

Functions

func New

func New(ctx context.Context, cfg config.Config, cfgPath string, isDebug, isIncognito bool) (*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(ctx context.Context, user models.User) error

Follow adds user to followings.

func (*Service) GetBusinessAccountsOrBotsFromFollowers

func (svc *Service) GetBusinessAccountsOrBotsFromFollowers(ctx context.Context) ([]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(ctx context.Context) ([]models.UsersBatch, error)

GetDiffFollowers returns batches with lost and new followers.

func (*Service) GetDiffFollowings added in v1.1.0

func (svc *Service) GetDiffFollowings(ctx context.Context) ([]models.UsersBatch, error)

GetDiffFollowings returns batches with lost and new followings.

func (*Service) GetFollowers

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

GetFollowers returns list of followers for logged-in user.

func (*Service) GetFollowings

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

GetFollowings returns list of followings for logged-in user.

func (*Service) GetHistoryDiffFollowers added in v1.1.0

func (svc *Service) GetHistoryDiffFollowers(ctx context.Context) (models.DiffHistory, error)

GetHistoryDiffFollowers returns diff history of followers for an account.

func (*Service) GetHistoryDiffFollowings added in v1.1.0

func (svc *Service) GetHistoryDiffFollowings(ctx context.Context) (models.DiffHistory, error)

GetHistoryDiffFollowings returns diff history of followings for an account.

func (*Service) GetNotMutualFollowers

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

GetNotMutualFollowers returns list of users that not following back.

func (*Service) RemoveFollowersByUsername added in v0.12.0

func (svc *Service) RemoveFollowersByUsername(ctx context.Context, usernames []string) (int, error)

RemoveFollowersByUsername removes all provided users by blocking and unblocking them to bypass Instagram limits.

func (*Service) UnFollow

func (svc *Service) UnFollow(ctx context.Context, user models.User) error

UnFollow removes user from followings.

func (*Service) UnFollowAllNotMutualExceptWhitelisted

func (svc *Service) UnFollowAllNotMutualExceptWhitelisted(ctx context.Context) (int, error)

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

type StopFunc

type StopFunc func() error

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