model

package
v0.3.1-beta.2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: AGPL-3.0 Imports: 11 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")
	ErrNameTooLong = errors.New("name too long")
	ErrTypeTooLong = errors.New("type too long")

	ErrId = errors.New("id must be greater than 0")

	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")

	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 (
	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 model.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 {
	Time  int64  `json:"time"`
	Error string `json:"error,omitempty"`
	Data  any    `json:"data,omitempty"`
}

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 CreateRoomReq

type CreateRoomReq struct {
	RoomName string               `json:"roomName"`
	Password string               `json:"password"`
	Setting  dbModel.RoomSettings `json:"setting"`
}

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 {
	Status op.Status  `json:"status"`
	Movie  MoviesResp `json:"movie"`
}

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 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 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"`
	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 MoviesResp added in v0.3.0

type MoviesResp struct {
	Id        string          `json:"id"`
	CreatedAt int64           `json:"createAt"`
	Base      model.BaseMovie `json:"base"`
	Creator   string          `json:"creator"`
	CreatorId string          `json:"creatorId"`
}

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) []*Path

type PushMovieReq

type PushMovieReq model.BaseMovie

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 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"`
	PeopleNum    int64            `json:"peopleNum"`
	NeedPassword bool             `json:"needPassword"`
	CreatorID    string           `json:"creatorId"`
	Creator      string           `json:"creator"`
	CreatedAt    int64            `json:"createdAt"`
	Status       model.RoomStatus `json:"status"`
}

type RoomUsersResp added in v0.3.0

type RoomUsersResp struct {
	UserID      string                     `json:"userId"`
	Username    string                     `json:"username"`
	Role        dbModel.Role               `json:"role"`
	JoinAt      int64                      `json:"joinAt"`
	RoomID      string                     `json:"roomId"`
	Status      dbModel.RoomUserStatus     `json:"status"`
	Permissions dbModel.RoomUserPermission `json:"permissions"`
}

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 dbModel.RoomSettings

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 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"`
	Role      dbModel.Role `json:"role"`
	CreatedAt int64        `json:"createdAt"`
}

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 {
	IsLogin bool `json:"isLogin"`
	Info    T    `json:"info,omitempty"`
}

Jump to

Keyboard shortcuts

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