services

package
v0.0.0-...-f464bf3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeleteNotAllowed = errors.New("You can't delete this comment")
View Source
var ErrNoComment = errors.New("Comment not found")
View Source
var ErrNoLike = errors.New("Like not found")
View Source
var ErrNoPhoto = errors.New("Photo not found")
View Source
var ErrNoUser = errors.New("User not found")
View Source
var ErrPhotoFormatNotSupported = errors.New("Unsupported image type")
View Source
var ErrUserForbidden = errors.New("You are not authorized to do this operations")

Functions

func NewWorkersFacade

func NewWorkersFacade(jobs ...*Job) <-chan *Work

Types

type AuthService

type AuthService interface {
	DoLogin(username string) (token string, newUser bool, err error)
	Authorize(token string) (*models.BaseUser, error)
}

type BansService

type BansService interface {
	BanUser(int, int) error
	UnbanUser(int, int) error
	IsBannedForUser(int, int) (bool, error)
}

BansService defines the api actions to ban/unban a user

func NewBansService

NewBansService creates a default api service

type CommentsService

type CommentsService interface {
	CommentPhoto(int, int, string) (*models.Comment, error)
	UncommentPhoto(int, int, int) error
	GetPhotoComments(int, int) (*[]models.Comment, error)
}

CommentsService defines the api actions to comment/uncomment a photo

func NewCommentsService

NewCommentsService creates a default api service

type FollowsService

type FollowsService interface {
	FollowUser(int, int) error
	GetUserFollowers(int, int) (*[]models.BaseUser, error)
	GetUserFollowings(int, int) (*[]models.BaseUser, error)
	UnfollowUser(int, int) error
}

FollowsService defines the api actions to follow/unfollow a user

func NewFollowsService

NewFollowsService creates a default api service

type Job

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

func NewJob

func NewJob(worker Worker) *Job

type LikesService

type LikesService interface {
	LikePhoto(int, int) error
	UnlikePhoto(int, int) error
	GetPhotoLikes(int, int) (*[]models.Like, error)
}

LikesService defines the api actions to like/unlike a photo

func NewLikesService

NewLikesService creates a default api service

type PhotosService

type PhotosService interface {
	GetUserPhotos(int, int, int, int) (*models.PaginatedPhotos, error)
	GetStream(int, int, int) (*models.PaginatedPhotos, error)
	CreatePhoto(int, io.Reader) (*models.Photo, error)
	DeletePhoto(int, int) error
}

PhotosService defines the api actions to manage photos

func NewPhotosService

NewPhotosService creates a default api service

type SendFunc

type SendFunc func(res interface{}, err error)

func NewSendWorkRes

func NewSendWorkRes(id int, out chan<- *Work) SendFunc

type UsersService

type UsersService interface {
	GetUser(int, int) (*models.FullUser, error)
	GetUsers(int, string) (*[]models.BaseUser, error)
	UpdateUsername(int, string) (*models.FullUser, error)
}

type Work

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

func NewWork

func NewWork(id int, res interface{}, err error) *Work

type Worker

type Worker func(newWorkRes SendFunc)

Jump to

Keyboard shortcuts

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