rest

package
v0.0.0-...-9f87b0a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewArticleHandler

func NewArticleHandler(e *echo.Echo, svc ArticleService)

NewArticleHandler will initialize the articles/ resources endpoint

func NewVideoHandler

func NewVideoHandler(e *echo.Echo, svc VideoService)

NewVideoHandler will initialize the videos/ resources endpoint

Types

type ArticleHandler

type ArticleHandler struct {
	Service ArticleService
}

ArticleHandler represent the httphandler for article

func (*ArticleHandler) Delete

func (a *ArticleHandler) Delete(c echo.Context) error

Delete will delete article by given param

func (*ArticleHandler) FetchArticle

func (a *ArticleHandler) FetchArticle(c echo.Context) error

FetchArticle will fetch the article based on given params

func (*ArticleHandler) GetByID

func (a *ArticleHandler) GetByID(c echo.Context) error

GetByID will get article by given id

func (*ArticleHandler) Store

func (a *ArticleHandler) Store(c echo.Context) (err error)

Store will store the article by given request body

type ArticleService

type ArticleService interface {
	Fetch(ctx context.Context, cursor string, num int64) ([]domain.Article, string, error)
	GetByID(ctx context.Context, id int64) (domain.Article, error)
	Update(ctx context.Context, ar *domain.Article) error
	GetByTitle(ctx context.Context, title string) (domain.Article, error)
	Store(context.Context, *domain.Article) error
	Delete(ctx context.Context, id int64) error
}

ArticleService represent the article's usecases

type ResponseError

type ResponseError struct {
	Message string `json:"message"`
}

ResponseError represent the response error struct

type VideoHandler

type VideoHandler struct {
	Service VideoService
}

VideoHandler represent the httphandler for video

func (*VideoHandler) HandleStreamWs

func (a *VideoHandler) HandleStreamWs(c echo.Context) error

func (*VideoHandler) SearchVideos

func (a *VideoHandler) SearchVideos(c echo.Context) error

FetchVideo will fetch the video based on given params

type VideoService

type VideoService interface {
	SearchVideos(ctx context.Context, text string, amount int64) ([]domain.SearchedVideo, error)
	GetStreamReader(ctx context.Context) (io.ReadCloser, error)
}

VideoService represent the video's usecases

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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