v2

package
v0.0.0-...-570c91f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIntervalLengthTooSmall = pgerr.ErrInvalidReq.Msg("interval length must be greater than 1 hour")

ErrIntervalLengthTooSmall is returned when the interval length is invalid

Functions

func Module

func Module() fx.Option

func RegisterAccount

func RegisterAccount(v2 *svr.V2, c Account)

func RegisterEventPeriod

func RegisterEventPeriod(v2 *svr.V2, c EventPeriod)

func RegisterFormula

func RegisterFormula(v2 *svr.V2, c Formula)

func RegisterFrontendConfig

func RegisterFrontendConfig(v2 *svr.V2, c FrontendConfig)

func RegisterItem

func RegisterItem(v2 *svr.V2, c Item)

func RegisterNotice

func RegisterNotice(v2 *svr.V2, c Notice)

func RegisterPrivate

func RegisterPrivate(v2 *svr.V2, c Private)

func RegisterReport

func RegisterReport(v2 *svr.V2, c Report)

func RegisterResult

func RegisterResult(v2 *svr.V2, c Result)

func RegisterShortURL

func RegisterShortURL(v2 *svr.V2, c ShortURL)

func RegisterSiteStats

func RegisterSiteStats(v2 *svr.V2, c SiteStats)

func RegisterStage

func RegisterStage(v2 *svr.V2, c Stage)

func RegisterUpyun

func RegisterUpyun(v2 *svr.V2, c Recognition)

func RegisterZone

func RegisterZone(v2 *svr.V2, c Zone)

Types

type Account

type Account struct {
	fx.In

	AccountService *service.Account
}

func (*Account) Login

func (c *Account) Login(ctx *fiber.Ctx) error

@Summary Login with PenguinID @Tags Account @Accept plain @Produce plain @Param userId body int true "User ID" @Success 200 {object} modelv2.LoginResponse "User ID. In the deprecated backend this is, for some reason, been implemented to return a JSON in the response body but with a `Content-Type: text/plain` in the response header instead of the correct `Content-Type: application/json`. So the v2 API has replicated this behavior to ensure compatibility." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Security PenguinIDAuth @Router /PenguinStats/api/v2/users [POST]

type EventPeriod

type EventPeriod struct {
	fx.In

	ActivityService *service.Activity
}

func (*EventPeriod) GetEventPeriods

func (c *EventPeriod) GetEventPeriods(ctx *fiber.Ctx) (err error)

@Summary Get All Event Periods @Tags EventPeriod @Produce json @Success 200 {array} modelv2.Activity{label_i18n=model.I18nString,existence=model.Existence} @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/period [GET]

type Formula

type Formula struct {
	fx.In

	FormulaService *service.Formula
}

func (*Formula) GetFormula

func (c *Formula) GetFormula(ctx *fiber.Ctx) error

@Summary Get Formula @Tags Formula @Produce json @Success 200 @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/formula [GET]

type FrontendConfig

type FrontendConfig struct {
	fx.In

	FrontendConfigService *service.FrontendConfig
}

func (*FrontendConfig) GetFrontendConfig

func (c *FrontendConfig) GetFrontendConfig(ctx *fiber.Ctx) error

@Summary Get FrontendConfig @Tags FrontendConfig @Produce json @Success 200 @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/config [GET]

type InitDefectReportRequest

type InitDefectReportRequest struct {
	RecognitionResult json.RawMessage                    `json:"recognitionResult" validate:"dive"`
	Environment       InitDefectReportRequestEnvironment `json:"environment" validate:"required,dive"`
}

type InitDefectReportRequestEnvironment

type InitDefectReportRequestEnvironment struct {
	FrontendVersion         string `json:"frontendVersion" validate:"required,max=32,printascii"`
	FrontendCommit          string `json:"frontendCommit" validate:"required,max=32,printascii"`
	RecognizerVersion       string `json:"recognizerVersion" validate:"required,max=32,printascii"`
	RecognizerOpenCVVersion string `json:"recognizerOpenCVVersion" validate:"required,max=32,printascii"`
	RecognizerAssetsVersion string `json:"recognizerAssetsVersion" validate:"required,max=32,printascii"`
	Server                  string `json:"server" validate:"required,arkserver"`
	SessionID               string `json:"sessionId" validate:"required,len=8,alphanum"`
}

type InitDefectReportResponse

type InitDefectReportResponse struct {
	UploadParams InitDefectReportResponseUploadParams `json:"uploadParams"`
	DefectID     string                               `json:"defectId"`
}

type InitDefectReportResponseUploadParams

type InitDefectReportResponseUploadParams struct {
	URL           string `json:"url"`
	Authorization string `json:"authorization"`
	Policy        string `json:"policy"`
}

type Item

type Item struct {
	fx.In

	ItemService *service.Item
}

func (*Item) GetItemByArkId

func (c *Item) GetItemByArkId(ctx *fiber.Ctx) error

@Summary Get an Item with ID @Tags Item @Produce json @Param itemId path string true "Item ID" @Success 200 {object} modelv2.Item{name_i18n=model.I18nString,existence=model.Existence} @Failure 400 {object} pgerr.PenguinError "Invalid or missing itemId. Notice that this shall be the **string ID** of the item, instead of the internally used numerical ID of the item." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/items/{itemId} [GET]

func (*Item) GetItems

func (c *Item) GetItems(ctx *fiber.Ctx) error

@Summary Get All Items @Tags Item @Produce json @Success 200 {array} modelv2.Item{name_i18n=model.I18nString,existence=model.Existence} @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/items [GET]

type Notice

type Notice struct {
	fx.In

	NoticeService *service.Notice
}

func (*Notice) GetNotices

func (c *Notice) GetNotices(ctx *fiber.Ctx) error

@Summary Get All Notices @Tags Notice @Produce json @Success 200 {array} model.Notice @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/notice [GET]

type Private

type Private struct {
	fx.In

	DropMatrixService    *service.DropMatrix
	PatternMatrixService *service.PatternMatrix
	TrendService         *service.Trend
	AccountService       *service.Account
	ItemService          *service.Item
	StageService         *service.Stage
}

func (*Private) GetDropMatrix

func (c *Private) GetDropMatrix(ctx *fiber.Ctx) error

func (*Private) GetPatternMatrix

func (c *Private) GetPatternMatrix(ctx *fiber.Ctx) error

func (*Private) GetTrends

func (c *Private) GetTrends(ctx *fiber.Ctx) error

type Recognition

type Recognition struct {
	fx.In

	RecognitionDefectRepo *repo.RecognitionDefect
	AccountService        *service.Account
	UpyunService          *service.Upyun
}

func (*Recognition) InitDefectReport

func (c *Recognition) InitDefectReport(ctx *fiber.Ctx) error

func (*Recognition) RetrieveDefectReportImageCallback

func (c *Recognition) RetrieveDefectReportImageCallback(ctx *fiber.Ctx) error

type Report

type Report struct {
	fx.In

	Redis          *redis.Client
	RedSync        *redsync.Redsync
	Crypto         *crypto.Crypto
	ReportService  *service.Report
	AccountService *service.Account
}

func (*Report) MiddlewareGetOrCreateAccount

func (c *Report) MiddlewareGetOrCreateAccount(ctx *fiber.Ctx) error

func (*Report) RecallSingularReport

func (c *Report) RecallSingularReport(ctx *fiber.Ctx) error

@Summary Recall a Drop Report @Description Recall a Drop Report by its `reportHash`. The farest report you can recall is limited to 24 hours. Recalling a report after it has been already recalled will result in an error. @Tags Report @Accept json @Produce json @Param report body types.SingularReportRecallRequest true "Report Recall request" @Success 204 "Report has been successfully recalled" @Failure 400 {object} pgerr.PenguinError "`reportHash` is missing, invalid, or already been recalled." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/report/recall [POST]

func (*Report) RecognitionReport

func (c *Report) RecognitionReport(ctx *fiber.Ctx) error

@Summary Bulk Submit with Frontend Recognition @Description Submit an Item Drop Report with Frontend Recognition. Notice that this is a **private API** and is not designed for external use. @Tags Report @Produce json @Param report body string true "Recognition Report Request" @Success 200 {object} modelv2.RecognitionReportResponse "Report has been successfully submitted for queue processing" @Failure 400 {object} pgerr.PenguinError "Invalid request" @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Security PenguinIDAuth @Router /PenguinStats/api/v2/report/recognition [POST]

func (*Report) SingularReport

func (c *Report) SingularReport(ctx *fiber.Ctx) error

@Summary Submit a Drop Report @Description Submit a Drop Report. You can use the `reportHash` in the response to recall the report in 24 hours after it has been submitted. @Tags Report @Accept json @Produce json @Param report body types.SingularReportRequest true "Report request" @Success 200 {object} modelv2.ReportResponse "Report has been successfully submitted" @Failure 400 {object} pgerr.PenguinError "Invalid request" @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Security PenguinIDAuth @Router /PenguinStats/api/v2/report [POST]

type Result

type Result struct {
	fx.In

	DropMatrixService    *service.DropMatrix
	PatternMatrixService *service.PatternMatrix
	TrendService         *service.Trend
	AccountService       *service.Account
	ItemService          *service.Item
	StageService         *service.Stage
}

func (*Result) AdvancedQuery

func (c *Result) AdvancedQuery(ctx *fiber.Ctx) error

@Summary Execute Advanced Query @Tags Result @Produce json @Param query body types.AdvancedQueryRequest true "Query" @Success 200 {object} modelv2.AdvancedQueryResult{advanced_results=[]modelv2.DropMatrixQueryResult} "Drop Matrix Response: when `interval` has been left undefined." @Success 202 {object} modelv2.AdvancedQueryResult{advanced_results=[]modelv2.TrendQueryResult} "Trend Response: when `interval` has been defined a value greater than `0`. Notice that this response still responds with a status code of `200`, but due to swagger limitations, to denote a different response with the same status code is not possible. Therefore, a status code of `202` is used, only for the purpose of workaround." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/result/advanced [POST]

func (*Result) GetDropMatrix

func (c *Result) GetDropMatrix(ctx *fiber.Ctx) error

@Summary Get Drop Matrix @Tags Result @Produce json @Param server query string true "Server; default to CN" Enums(CN, US, JP, KR) @Param is_personal query bool false "Whether to query for personal drop matrix or not. If `is_personal` equals to `true`, a valid PenguinID would be required to be provided (PenguinIDAuth)" @Param show_closed_zones query bool false "Whether to show closed stages or not" @Param category query string false "Category; default to all" Enums(all, automated, manual) @Param stageFilter query []string false "Comma separated list of stage IDs to filter" collectionFormat(csv) @Param itemFilter query []string false "Comma separated list of item IDs to filter" collectionFormat(csv) @Success 200 {object} modelv2.DropMatrixQueryResult "Drop Matrix response" @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Security PenguinIDAuth @Router /PenguinStats/api/v2/result/matrix [GET]

func (*Result) GetPatternMatrix

func (c *Result) GetPatternMatrix(ctx *fiber.Ctx) error

@Summary Get Pattern Matrix @Tags Result @Produce json @Param server query string true "Server; default to CN" Enums(CN, US, JP, KR) @Param is_personal query bool false "Whether to query for personal drop matrix or not. If `is_personal` equals to `true`, a valid PenguinID would be required to be provided (PenguinIDAuth)" @Param showAllPatterns query bool false "Show all patterns; default to false" @Success 200 {object} modelv2.PatternMatrixQueryResult @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Security PenguinIDAuth @Router /PenguinStats/api/v2/result/pattern [GET]

func (*Result) GetTrends

func (c *Result) GetTrends(ctx *fiber.Ctx) error

@Summary Get Trends @Tags Result @Produce json @Param server query string true "Server; default to CN" Enums(CN, US, JP, KR) @Success 200 {object} modelv2.TrendQueryResult @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/result/trends [GET]

type ShortURL

type ShortURL struct {
	fx.In

	ShortURLService *service.ShortURL
}

func (*ShortURL) Resolve

func (c *ShortURL) Resolve(ctx *fiber.Ctx) error

type SiteStats

type SiteStats struct {
	fx.In

	SiteStatsService *service.SiteStats
}

func (*SiteStats) GetSiteStats

func (c *SiteStats) GetSiteStats(ctx *fiber.Ctx) error

@Summary Get Site Stats @Tags SiteStats @Produce json @Param server query string true "Server; default to CN" Enums(CN, US, JP, KR) @Success 200 {array} modelv2.SiteStats @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/stats [GET]

type Stage

type Stage struct {
	fx.In

	StageService *service.Stage
}

func (*Stage) GetStageByArkId

func (c *Stage) GetStageByArkId(ctx *fiber.Ctx) error

@Summary Get a Stage with ID @Tags Stage @Produce json @Param stageId path int true "Stage ID" @Success 200 {object} modelv2.Stage{existence=model.Existence,code_i18n=model.I18nString} @Failure 400 {object} pgerr.PenguinError "Invalid or missing stageId. Notice that this shall be the **string ID** of the stage, instead of the internally used numerical ID of the stage." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/stages/{stageId} [GET]

func (*Stage) GetStages

func (c *Stage) GetStages(ctx *fiber.Ctx) error

@Summary Get All Stages @Tags Stage @Produce json @Success 200 {array} modelv2.Stage{existence=model.Existence,code_i18n=model.I18nString} @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/stages [GET]

type Zone

type Zone struct {
	fx.In

	ZoneService *service.Zone
}

func (*Zone) GetZoneByArkId

func (c *Zone) GetZoneByArkId(ctx *fiber.Ctx) error

@Summary Get a Zone with ID @Tags Zone @Produce json @Param zoneId path int true "Zone ID" @Success 200 {object} modelv2.Zone{existence=model.Existence,zoneName_i18n=model.I18nString} @Failure 400 {object} pgerr.PenguinError "Invalid or missing zoneId. Notice that this shall be the **string ID** of the zone, instead of the v3 API internally used numerical ID of the zone." @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/zones/{zoneId} [GET]

func (*Zone) GetZones

func (c *Zone) GetZones(ctx *fiber.Ctx) error

@Summary Get All Zones @Tags Zone @Produce json @Success 200 {array} modelv2.Zone{existence=model.Existence,zoneName_i18n=model.I18nString} @Failure 500 {object} pgerr.PenguinError "An unexpected error occurred" @Router /PenguinStats/api/v2/zones [GET]

Jump to

Keyboard shortcuts

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