service

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

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")
	// ErrNoUsernamesPassed returns when usernames list is empty.
	ErrNoUsernamesPassed = errors.New("no usernames passed")
	// ErrUserInWhitelist means that user skipped.
	ErrUserInWhitelist = errors.New("user in whitelist")
	// ErrUserNotFound returned when user not found.
	ErrUserNotFound = errors.New("user not found")
)

Functions

This section is empty.

Types

type Params added in v1.10.0

type Params struct {
	SessionPath string
	IsIncognito bool
	Username    string
}

Params holds Service constructor parameters.

type Service

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

Service represents service for operating instagram account.

func New

func New(ctx context.Context, cfg config.Config, params Params) (*Service, error)

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

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

func (*Service) Follow

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

Follow adds user to followings.

func (*Service) FollowUsers added in v1.6.0

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

FollowUsers follows users by the name passed.

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) GetUselessFollowers added in v1.5.0

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

GetUselessFollowers 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) 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) Stop added in v1.5.0

func (svc *Service) Stop(ctx context.Context) error

Stop stops the service and closes clients connections.

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.

func (*Service) UnfollowUsers added in v1.4.0

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

UnfollowUsers unfollows users by the name passed.

func (*Service) UploadMedia added in v1.12.0

func (svc *Service) UploadMedia(ctx context.Context, file io.Reader, mt media.Type) error

UploadMedia uploads media to profile.

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