model

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidOAuth2Code  = errors.New("invalid oauth2 code")
	ErrInvalidOAuth2State = errors.New("invalid oauth2 state")
)
View Source
var (
	ErrUrlTooLong  = errors.New("url too long")
	ErrEmptyName   = errors.New("empty name")
	ErrTypeTooLong = errors.New("type too long")

	ErrId = errors.New("id length must be 32")

	ErrEmptyIds = errors.New("empty ids")
)
View Source
var (
	ErrEmptyRoomName          = errors.New("empty room name")
	ErrRoomNameTooLong        = errors.New("room name too long")
	ErrRoomNameHasInvalidChar = errors.New("room name has invalid char")

	ErrPasswordTooLong        = errors.New("password too long")
	ErrPasswordHasInvalidChar = errors.New("password has invalid char")
)
View Source
var (
	ErrEmptyUserId            = errors.New("empty user id")
	ErrEmptyUsername          = errors.New("empty username")
	ErrUsernameTooLong        = errors.New("username too long")
	ErrUsernameHasInvalidChar = errors.New("username has invalid char")
)
View Source
var (
	ErrEmailTooLong = errors.New("email is too long")
	ErrInvalidEmail = errors.New("invalid email")
)
View Source
var ErrInvalidID = errors.New("invalid id")

Functions

func Decode

func Decode(ctx *gin.Context, decoder Decoder) error

Types

type AddUserReq added in v0.3.0

type AddUserReq struct {
	Username string       `json:"username"`
	Password string       `json:"password"`
	Role     dbModel.Role `json:"role"`
}

func (*AddUserReq) Decode added in v0.3.0

func (aur *AddUserReq) Decode(ctx *gin.Context) error

func (*AddUserReq) Validate added in v0.3.0

func (aur *AddUserReq) Validate() error

type AddVendorBackendReq added in v0.3.1

type AddVendorBackendReq dbModel.VendorBackend

func (*AddVendorBackendReq) Decode added in v0.3.1

func (avbr *AddVendorBackendReq) Decode(ctx *gin.Context) error

func (*AddVendorBackendReq) Validate added in v0.3.1

func (avbr *AddVendorBackendReq) Validate() error

type AdminRoomPasswordReq added in v0.3.0

type AdminRoomPasswordReq struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

func (*AdminRoomPasswordReq) Decode added in v0.3.0

func (aur *AdminRoomPasswordReq) Decode(ctx *gin.Context) error

func (*AdminRoomPasswordReq) Validate added in v0.3.0

func (aur *AdminRoomPasswordReq) Validate() error

type AdminSettingsReq added in v0.3.0

type AdminSettingsReq map[string]any

func (*AdminSettingsReq) Decode added in v0.3.0

func (asr *AdminSettingsReq) Decode(ctx *gin.Context) error

func (*AdminSettingsReq) Validate added in v0.3.0

func (asr *AdminSettingsReq) Validate() error

type AdminSettingsResp added in v0.3.0

type AdminSettingsResp map[dbModel.SettingGroup]map[string]any

type AdminUserPasswordReq added in v0.3.0

type AdminUserPasswordReq struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

func (*AdminUserPasswordReq) Decode added in v0.3.0

func (aur *AdminUserPasswordReq) Decode(ctx *gin.Context) error

func (*AdminUserPasswordReq) Validate added in v0.3.0

func (aur *AdminUserPasswordReq) Validate() error

type AdminUsernameReq added in v0.3.0

type AdminUsernameReq struct {
	ID       string `json:"id"`
	Username string `json:"username"`
}

func (*AdminUsernameReq) Decode added in v0.3.0

func (aur *AdminUsernameReq) Decode(ctx *gin.Context) error

func (*AdminUsernameReq) Validate added in v0.3.0

func (aur *AdminUsernameReq) Validate() error

type ApiResp

type ApiResp struct {
	Data  any    `json:"data,omitempty"`
	Error string `json:"error,omitempty"`
	Time  int64  `json:"time"`
}

func NewApiDataResp

func NewApiDataResp(data any) *ApiResp

func NewApiErrorResp

func NewApiErrorResp(err error) *ApiResp

func NewApiErrorStringResp

func NewApiErrorStringResp(err string) *ApiResp

func (*ApiResp) SetDate

func (ar *ApiResp) SetDate(data any)

func (*ApiResp) SetError

func (ar *ApiResp) SetError(err error)

type CheckRoomPasswordReq added in v0.7.0

type CheckRoomPasswordReq struct {
	Password string `json:"password"`
}

func (*CheckRoomPasswordReq) Decode added in v0.7.0

func (c *CheckRoomPasswordReq) Decode(ctx *gin.Context) error

func (*CheckRoomPasswordReq) Validate added in v0.7.0

func (c *CheckRoomPasswordReq) Validate() error

type CheckRoomResp added in v0.7.1

type CheckRoomResp struct {
	Name         string             `json:"name"`
	CreatorID    string             `json:"creatorId"`
	Creator      string             `json:"creator"`
	ViewerCount  int64              `json:"viewerCount"`
	Status       dbModel.RoomStatus `json:"status"`
	NeedPassword bool               `json:"needPassword"`
	EnabledGuest bool               `json:"enabledGuest"`
}

type ClearMoviesReq added in v0.6.0

type ClearMoviesReq struct {
	ParentId string `json:"parentId"`
}

func (*ClearMoviesReq) Decode added in v0.6.0

func (c *ClearMoviesReq) Decode(ctx *gin.Context) error

func (*ClearMoviesReq) Validate added in v0.6.0

func (c *ClearMoviesReq) Validate() error

type CreateRoomReq

type CreateRoomReq struct {
	RoomName string `json:"roomName"`
	Password string `json:"password"`
	Settings struct {
		Hidden bool `json:"hidden"`
	} `json:"settings"`
}

func (*CreateRoomReq) Decode

func (c *CreateRoomReq) Decode(ctx *gin.Context) error

func (*CreateRoomReq) Validate

func (c *CreateRoomReq) Validate() error

type CurrentMovieResp added in v0.3.0

type CurrentMovieResp struct {
	Movie    *Movie    `json:"movie"`
	Status   op.Status `json:"status"`
	ExpireId uint64    `json:"expireId"`
}

type Decoder

type Decoder interface {
	Decode(ctx *gin.Context) error
	Validate() error
}

type EditMovieReq

type EditMovieReq struct {
	IdReq
	PushMovieReq
}

func (*EditMovieReq) Decode

func (e *EditMovieReq) Decode(ctx *gin.Context) error

func (*EditMovieReq) Validate

func (e *EditMovieReq) Validate() error

type FormatEmptyPasswordError added in v0.3.0

type FormatEmptyPasswordError string

func (FormatEmptyPasswordError) Error added in v0.3.0

func (f FormatEmptyPasswordError) Error() string

type GetUserBindEmailStep1CaptchaResp added in v0.4.5

type GetUserBindEmailStep1CaptchaResp struct {
	CaptchaID     string `json:"captchaID"`
	CaptchaBase64 string `json:"captchaBase64"`
}

type GetVendorBackendResp added in v0.3.1

type GetVendorBackendResp struct {
	Info   *dbModel.VendorBackend `json:"info"`
	Status connectivity.State     `json:"status"`
}

type IdCanEmptyReq added in v0.3.0

type IdCanEmptyReq struct {
	Id string `json:"id"`
}

func (*IdCanEmptyReq) Decode added in v0.3.0

func (i *IdCanEmptyReq) Decode(ctx *gin.Context) error

func (*IdCanEmptyReq) Validate added in v0.3.0

func (i *IdCanEmptyReq) Validate() error

type IdReq

type IdReq struct {
	Id string `json:"id"`
}

func (*IdReq) Decode

func (i *IdReq) Decode(ctx *gin.Context) error

func (*IdReq) Validate

func (i *IdReq) Validate() error

type IdsReq

type IdsReq struct {
	Ids []string `json:"ids"`
}

func (*IdsReq) Decode

func (i *IdsReq) Decode(ctx *gin.Context) error

func (*IdsReq) Validate

func (i *IdsReq) Validate() error

type Item added in v0.3.1

type Item struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"isDir"`
}

type JoinedRoomResp added in v0.7.0

type JoinedRoomResp struct {
	RoomListResp
	MemberStatus dbModel.RoomMemberStatus `json:"memberStatus"`
	MemberRole   dbModel.RoomMemberRole   `json:"memberRole"`
}

type LoginRoomReq

type LoginRoomReq struct {
	RoomId   string `json:"roomId"`
	Password string `json:"password"`
}

func (*LoginRoomReq) Decode

func (l *LoginRoomReq) Decode(ctx *gin.Context) error

func (*LoginRoomReq) Validate

func (l *LoginRoomReq) Validate() error

type LoginUserReq added in v0.3.0

type LoginUserReq struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (*LoginUserReq) Decode added in v0.3.0

func (l *LoginUserReq) Decode(ctx *gin.Context) error

func (*LoginUserReq) Validate added in v0.3.0

func (l *LoginUserReq) Validate() error

type Movie added in v0.6.0

type Movie struct {
	Id        string          `json:"id"`
	Creator   string          `json:"creator"`
	CreatorId string          `json:"creatorId"`
	SubPath   string          `json:"subPath"`
	Base      model.MovieBase `json:"base"`
	CreatedAt int64           `json:"createAt"`
}

type MovieList added in v0.7.0

type MovieList struct {
	Paths  []*MoviePath `json:"paths"`
	Movies []*Movie     `json:"movies"`
	Total  int64        `json:"total"`
}

type MoviePath added in v0.6.0

type MoviePath struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	SubPath string `json:"subPath"`
}

func GenDefaultSubPaths added in v0.6.0

func GenDefaultSubPaths(id, path string, skipEmpty bool, paths ...*MoviePath) []*MoviePath

type MoviesResp added in v0.3.0

type MoviesResp struct {
	*MovieList
	Dynamic bool `json:"dynamic"`
}

type OAuth2CallbackReq added in v0.3.0

type OAuth2CallbackReq struct {
	Code  string `json:"code"`
	State string `json:"state"`
}

func (*OAuth2CallbackReq) Decode added in v0.3.0

func (o *OAuth2CallbackReq) Decode(ctx *gin.Context) error

func (*OAuth2CallbackReq) Validate added in v0.3.0

func (o *OAuth2CallbackReq) Validate() error

type OAuth2Req added in v0.3.0

type OAuth2Req struct {
	Redirect string `json:"redirect"`
}

func (*OAuth2Req) Decode added in v0.3.0

func (o *OAuth2Req) Decode(ctx *gin.Context) error

func (*OAuth2Req) Validate added in v0.3.0

func (o *OAuth2Req) Validate() error

type Path added in v0.3.1

type Path struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

func GenDefaultPaths added in v0.3.1

func GenDefaultPaths(path string, skipEmpty bool, paths ...*Path) []*Path

type PushMovieReq

type PushMovieReq model.MovieBase

func (*PushMovieReq) Decode

func (p *PushMovieReq) Decode(ctx *gin.Context) error

func (*PushMovieReq) Validate

func (p *PushMovieReq) Validate() error

type PushMoviesReq added in v0.3.0

type PushMoviesReq []*PushMovieReq

func (*PushMoviesReq) Decode added in v0.3.0

func (p *PushMoviesReq) Decode(ctx *gin.Context) error

func (*PushMoviesReq) Validate added in v0.3.0

func (p *PushMoviesReq) Validate() error

type RoomApproveMemberReq added in v0.5.0

type RoomApproveMemberReq = UserIDReq

type RoomBanMemberReq added in v0.5.0

type RoomBanMemberReq = UserIDReq

type RoomIDReq added in v0.3.0

type RoomIDReq struct {
	Id string `json:"id"`
}

func (*RoomIDReq) Decode added in v0.3.0

func (r *RoomIDReq) Decode(ctx *gin.Context) error

func (*RoomIDReq) Validate added in v0.3.0

func (r *RoomIDReq) Validate() error

type RoomListResp

type RoomListResp struct {
	RoomId       string             `json:"roomId"`
	RoomName     string             `json:"roomName"`
	CreatorID    string             `json:"creatorId"`
	Creator      string             `json:"creator"`
	ViewerCount  int64              `json:"viewerCount"`
	CreatedAt    int64              `json:"createdAt"`
	NeedPassword bool               `json:"needPassword"`
	Status       dbModel.RoomStatus `json:"status"`
}

type RoomMeResp added in v0.5.0

type RoomMeResp struct {
	UserID           string                       `json:"userId"`
	RoomID           string                       `json:"roomId"`
	JoinAt           int64                        `json:"joinAt"`
	Role             dbModel.RoomMemberRole       `json:"role"`
	Status           dbModel.RoomMemberStatus     `json:"status"`
	Permissions      dbModel.RoomMemberPermission `json:"permissions"`
	AdminPermissions dbModel.RoomAdminPermission  `json:"adminPermissions"`
}

type RoomMembersResp added in v0.5.0

type RoomMembersResp struct {
	UserID           string                       `json:"userId"`
	Username         string                       `json:"username"`
	RoomID           string                       `json:"roomId"`
	JoinAt           int64                        `json:"joinAt"`
	OnlineCount      int                          `json:"onlineCount"`
	Permissions      dbModel.RoomMemberPermission `json:"permissions"`
	AdminPermissions dbModel.RoomAdminPermission  `json:"adminPermissions"`
	Role             dbModel.RoomMemberRole       `json:"role"`
	Status           dbModel.RoomMemberStatus     `json:"status"`
}

type RoomSetAdminPermissionsReq added in v0.5.0

type RoomSetAdminPermissionsReq struct {
	UserIDReq
	AdminPermissions dbModel.RoomAdminPermission `json:"adminPermissions"`
}

func (*RoomSetAdminPermissionsReq) Decode added in v0.5.0

func (r *RoomSetAdminPermissionsReq) Decode(ctx *gin.Context) error

type RoomSetAdminReq added in v0.5.0

type RoomSetAdminReq struct {
	UserIDReq
	AdminPermissions dbModel.RoomAdminPermission `json:"adminPermissions"`
}

func (*RoomSetAdminReq) Decode added in v0.5.0

func (r *RoomSetAdminReq) Decode(ctx *gin.Context) error

type RoomSetMemberPermissionsReq added in v0.5.0

type RoomSetMemberPermissionsReq struct {
	UserIDReq
	Permissions dbModel.RoomMemberPermission `json:"permissions"`
}

func (*RoomSetMemberPermissionsReq) Decode added in v0.5.0

func (r *RoomSetMemberPermissionsReq) Decode(ctx *gin.Context) error

type RoomSetMemberReq added in v0.5.0

type RoomSetMemberReq struct {
	UserIDReq
	Permissions dbModel.RoomMemberPermission `json:"permissions"`
}

func (*RoomSetMemberReq) Decode added in v0.5.0

func (r *RoomSetMemberReq) Decode(ctx *gin.Context) error

type RoomUnbanMemberReq added in v0.5.0

type RoomUnbanMemberReq = UserIDReq

type SendTestEmailReq added in v0.4.5

type SendTestEmailReq struct {
	Email string `json:"email"`
}

func (*SendTestEmailReq) Decode added in v0.4.5

func (ster *SendTestEmailReq) Decode(ctx *gin.Context) error

func (*SendTestEmailReq) Validate added in v0.4.5

func (ster *SendTestEmailReq) Validate() error

type SendUserRetrievePasswordEmailCaptchaReq added in v0.4.5

type SendUserRetrievePasswordEmailCaptchaReq = UserSendBindEmailCaptchaReq

type SendUserSignupEmailCaptchaReq added in v0.4.5

type SendUserSignupEmailCaptchaReq = UserSendBindEmailCaptchaReq

type ServerIDReq added in v0.3.2

type ServerIDReq struct {
	ServerID string `json:"serverId"`
}

func (*ServerIDReq) Decode added in v0.3.2

func (r *ServerIDReq) Decode(ctx *gin.Context) error

func (*ServerIDReq) Validate added in v0.3.2

func (r *ServerIDReq) Validate() error

type SetRoomCurrentMovieReq added in v0.6.0

type SetRoomCurrentMovieReq struct {
	IdCanEmptyReq
	SubPath string `json:"subPath"`
}

func (*SetRoomCurrentMovieReq) Decode added in v0.6.0

func (s *SetRoomCurrentMovieReq) Decode(ctx *gin.Context) error

type SetRoomPasswordReq

type SetRoomPasswordReq struct {
	Password string `json:"password"`
}

func (*SetRoomPasswordReq) Decode

func (s *SetRoomPasswordReq) Decode(ctx *gin.Context) error

func (*SetRoomPasswordReq) Validate

func (s *SetRoomPasswordReq) Validate() error

type SetRoomSettingReq added in v0.3.0

type SetRoomSettingReq map[string]any

func (*SetRoomSettingReq) Decode added in v0.3.0

func (s *SetRoomSettingReq) Decode(ctx *gin.Context) error

func (*SetRoomSettingReq) Validate added in v0.3.0

func (s *SetRoomSettingReq) Validate() error

type SetUserPasswordReq

type SetUserPasswordReq struct {
	Password string `json:"password"`
}

func (*SetUserPasswordReq) Decode

func (s *SetUserPasswordReq) Decode(ctx *gin.Context) error

func (*SetUserPasswordReq) Validate

func (s *SetUserPasswordReq) Validate() error

type SetUsernameReq added in v0.3.0

type SetUsernameReq struct {
	Username string `json:"username"`
}

func (*SetUsernameReq) Decode added in v0.3.0

func (s *SetUsernameReq) Decode(ctx *gin.Context) error

func (*SetUsernameReq) Validate added in v0.3.0

func (s *SetUsernameReq) Validate() error

type SwapMovieReq

type SwapMovieReq struct {
	Id1 string `json:"id1"`
	Id2 string `json:"id2"`
}

func (*SwapMovieReq) Decode

func (s *SwapMovieReq) Decode(ctx *gin.Context) error

func (*SwapMovieReq) Validate

func (s *SwapMovieReq) Validate() error

type UserBindEmailReq added in v0.4.5

type UserBindEmailReq struct {
	Email   string `json:"email"`
	Captcha string `json:"captcha"`
}

func (*UserBindEmailReq) Decode added in v0.4.5

func (u *UserBindEmailReq) Decode(ctx *gin.Context) error

func (*UserBindEmailReq) Validate added in v0.4.5

func (u *UserBindEmailReq) Validate() error

type UserBindProviderResp added in v0.3.0

type UserBindProviderResp map[provider.OAuth2Provider]struct {
	ProviderUserID string `json:"providerUserID"`
	CreatedAt      int64  `json:"createdAt"`
}

type UserIDReq added in v0.3.0

type UserIDReq struct {
	ID string `json:"id"`
}

func (*UserIDReq) Decode added in v0.3.0

func (u *UserIDReq) Decode(ctx *gin.Context) error

func (*UserIDReq) Validate added in v0.3.0

func (u *UserIDReq) Validate() error

type UserInfoResp added in v0.3.0

type UserInfoResp struct {
	ID        string       `json:"id"`
	Username  string       `json:"username"`
	Email     string       `json:"email"`
	CreatedAt int64        `json:"createdAt"`
	Role      dbModel.Role `json:"role"`
}

type UserRetrievePasswordEmailReq added in v0.4.5

type UserRetrievePasswordEmailReq struct {
	Email    string `json:"email"`
	Captcha  string `json:"captcha"`
	Password string `json:"password"`
}

func (*UserRetrievePasswordEmailReq) Decode added in v0.4.5

func (*UserRetrievePasswordEmailReq) Validate added in v0.4.5

func (u *UserRetrievePasswordEmailReq) Validate() error

type UserSendBindEmailCaptchaReq added in v0.4.5

type UserSendBindEmailCaptchaReq struct {
	Email     string `json:"email"`
	CaptchaID string `json:"captchaID"`
	Answer    string `json:"answer"`
}

func (*UserSendBindEmailCaptchaReq) Decode added in v0.4.5

func (u *UserSendBindEmailCaptchaReq) Decode(ctx *gin.Context) error

func (*UserSendBindEmailCaptchaReq) Validate added in v0.4.5

func (u *UserSendBindEmailCaptchaReq) Validate() error

type UserSignupEmailReq added in v0.4.5

type UserSignupEmailReq struct {
	UserBindEmailReq
	Password string `json:"password"`
}

func (*UserSignupEmailReq) Decode added in v0.4.5

func (u *UserSignupEmailReq) Decode(ctx *gin.Context) error

func (*UserSignupEmailReq) Validate added in v0.4.5

func (u *UserSignupEmailReq) Validate() error

type UserSignupPasswordReq added in v0.7.0

type UserSignupPasswordReq struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*UserSignupPasswordReq) Decode added in v0.7.0

func (u *UserSignupPasswordReq) Decode(ctx *gin.Context) error

func (*UserSignupPasswordReq) Validate added in v0.7.0

func (u *UserSignupPasswordReq) Validate() error

type VendorBackendEndpointsReq added in v0.3.1

type VendorBackendEndpointsReq struct {
	Endpoints []string `json:"endpoints"`
}

func (*VendorBackendEndpointsReq) Decode added in v0.3.1

func (dvbr *VendorBackendEndpointsReq) Decode(ctx *gin.Context) error

func (*VendorBackendEndpointsReq) Validate added in v0.3.1

func (dvbr *VendorBackendEndpointsReq) Validate() error

type VendorFSListResp added in v0.3.1

type VendorFSListResp[T any] struct {
	Paths []*Path `json:"paths"`
	Items []T     `json:"items"`
	Total uint64  `json:"total"`
}

type VendorMeResp added in v0.3.1

type VendorMeResp[T any] struct {
	Info    T    `json:"info,omitempty"`
	IsLogin bool `json:"isLogin"`
}

Jump to

Keyboard shortcuts

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