service

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode string
const (
	// 4xx
	ErrCodeBadRequest             ErrCode = "BAD_REQUEST"
	ErrCodeUnsupportedImageFormat ErrCode = "UNSUPPORTED_IMAGE_FORMAT"
	ErrCodeFailedToGetImage       ErrCode = "FAILED_TO_GET_IMAGE"
	ErrCodeNotFound               ErrCode = "NOT_FOUND"
	ErrCodeRateLimitReached       ErrCode = "RATE_LIMIT_REACHED"

	// 5xx
	ErrCodeInternalServerError ErrCode = "INTERNAL_SERVER_ERROR"
)

type ErrorResponse

type ErrorResponse struct {
	Code ErrCode `json:"code" validate:"required"`
}

type Service

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

func New

func New(ctx context.Context, repo *repo.Repository) (*Service, error)

func (Service) CategorizeLGTM added in v0.4.0

func (svc Service) CategorizeLGTM(ctx context.Context) error

func (Service) CreateLGTM

func (svc Service) CreateLGTM(ctx *gin.Context)

@Router /v1/lgtms [post] @Accept json @Param body body createLGTMInput true "body" @Success 201 {object} models.LGTM @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse

func (Service) CreateReport

func (s Service) CreateReport(ctx *gin.Context)

@Router /v1/reports [post] @Accept json @Param body body createReportInput true "body" @Success 201 {object} models.Report @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse

func (Service) DeleteLGTM added in v0.3.0

func (svc Service) DeleteLGTM(ctx context.Context, id string) error

func (Service) HealthCheck

func (s Service) HealthCheck(ctx *gin.Context)

func (Service) ListCategories added in v0.4.0

func (svc Service) ListCategories(ctx *gin.Context)

@Router /v1/categories [get] @Param lang query string false "lang" @Success 200 {array} models.Category @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse

func (Service) ListLGTMs

func (svc Service) ListLGTMs(ctx *gin.Context)

@Router /v1/lgtms [get] @Param limit query int false "limit" @Param after query string false "after" @Param random query bool false "random" @Param category query string false "category" @Param lang query string false "lang" @Success 200 {array} models.LGTM @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse

func (Service) ListNews

func (svc Service) ListNews(ctx *gin.Context)
	@Router		/v1/news [get]
 @Param locale query string false "locale"
	@Success	200	{array}		models.News
	@Failure	500	{object}	ErrorResponse

func (Service) Notify

func (s Service) Notify(ctx context.Context, event *events.SQSEvent) error

func (Service) SearchImages

func (s Service) SearchImages(ctx *gin.Context)

@Router /v1/images [get] @Param q query string true "query" @Success 200 {array} models.Image @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse

Jump to

Keyboard shortcuts

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