Documentation ¶
Index ¶
- Constants
- func ValidateRole(role string) bool
- func ValidateSortRequest(sort string) error
- type AuthenticatedRequest
- type CreateGenreRequest
- type CreateMovieRequest
- type CreateReviewRequest
- type CreateStarRequest
- type DeleteGenreRequest
- type DeleteMovieRequest
- type DeleteReviewRequest
- type DeleteStarRequest
- type DeleteUserRequest
- type Genre
- type GetGenreRequest
- type GetMovieRequest
- type GetMoviesRequest
- type GetReviewRequest
- type GetReviewsByMovieIDRequest
- type GetReviewsByUserIDRequest
- type GetStarRequest
- type GetStarsRequest
- type GetUserByIDRequest
- type GetUserByUsernameRequest
- type HTTPError
- type LoginUserRequest
- type LoginUserResponse
- type Movie
- type MovieCredit
- type MovieCreditInfo
- type MovieCreditV2
- type MovieDetails
- type MovieDetailsV2
- type PaginatedRequest
- type PaginatedRequestOrdered
- type PaginatedResponse
- type PaginatedResponseOrdered
- type PaginationGetter
- type PaginationSetter
- type RegisterUserRequest
- type Review
- type Star
- type StarV2
- type UpdateGenreRequest
- type UpdateMovieRequest
- type UpdateReviewRequest
- type UpdateStarRequest
- type UpdateUserRequest
- type UpdateUserRoleRequest
- type User
- type UserWithPassword
Constants ¶
View Source
const ( AdminRole = "admin" EditorRole = "editor" UserRole = "user" )
Variables ¶
This section is empty.
Functions ¶
func ValidateRole ¶
func ValidateSortRequest ¶
Types ¶
type AuthenticatedRequest ¶
func NewAuthenticated ¶
func NewAuthenticated[T any](req T, accessToken string) *AuthenticatedRequest[T]
type CreateGenreRequest ¶
type CreateGenreRequest struct {
Name string `json:"name" validate:"min=3,max=32"`
}
type CreateMovieRequest ¶
type CreateMovieRequest struct { Title string `json:"title" validate:"min=1,max=100"` ReleaseDate time.Time `json:"releaseDate" validate:"nonzero"` PosterURL *string `json:"posterUrl,omitempty"` IMDbRating *float64 `json:"imdbRating,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` Metascore *int `json:"metascore,omitempty"` MetascoreURL *string `json:"metascoreUrl,omitempty"` Description string `json:"description"` GenreIDs []int `json:"genreIds" validate:"nonzero"` Cast []MovieCreditInfo `json:"cast"` }
type CreateReviewRequest ¶
type CreateStarRequest ¶
type CreateStarRequest struct { FirstName string `json:"firstName" validate:"min=1,max=50"` MiddleName *string `json:"middleName,omitempty" validate:"max=50"` LastName string `json:"lastName" validate:"min=1,max=50"` AvatarURL *string `json:"avatarUrl,omitempty"` BirthDate time.Time `json:"birthDate" validate:"nonzero"` BirthPlace *string `json:"birthPlace,omitempty" validate:"max=100"` DeathDate *time.Time `json:"deathDate,omitempty"` Bio *string `json:"bio,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` }
type DeleteGenreRequest ¶
type DeleteGenreRequest struct {
GenreID int `json:"-" param:"genreId" validate:"nonzero"`
}
type DeleteMovieRequest ¶
type DeleteMovieRequest struct {
MovieID int `json:"-" param:"movieId" validate:"nonzero"`
}
type DeleteReviewRequest ¶
type DeleteStarRequest ¶
type DeleteStarRequest struct {
StarID int `json:"-" param:"starId" validate:"nonzero"`
}
type DeleteUserRequest ¶
type DeleteUserRequest struct {
UserID int `json:"-" param:"userId" validate:"nonzero"`
}
type GetGenreRequest ¶
type GetGenreRequest struct {
GenreID int `json:"-" param:"genreId" validate:"nonzero"`
}
type GetMovieRequest ¶
type GetMovieRequest struct {
MovieID int `json:"-" param:"movieId" validate:"nonzero"`
}
type GetMoviesRequest ¶
type GetMoviesRequest struct { PaginatedRequestOrdered SearchTerm *string `json:"-" query:"q"` }
func (*GetMoviesRequest) ToQueryParams ¶
func (r *GetMoviesRequest) ToQueryParams() map[string]string
type GetReviewRequest ¶
type GetReviewRequest struct {
ReviewID int `json:"-" param:"reviewId" validate:"nonzero"`
}
type GetReviewsByMovieIDRequest ¶
type GetReviewsByMovieIDRequest struct { PaginatedRequestOrdered MovieID int `json:"-" param:"movieId" validate:"nonzero"` }
type GetReviewsByUserIDRequest ¶
type GetReviewsByUserIDRequest struct { PaginatedRequestOrdered UserID int `json:"-" param:"userId" validate:"nonzero"` }
type GetStarRequest ¶
type GetStarRequest struct {
StarID int `json:"" param:"starId" validate:"nonzero"`
}
type GetStarsRequest ¶
type GetStarsRequest struct {
PaginatedRequestOrdered
}
type GetUserByIDRequest ¶
type GetUserByIDRequest struct {
UserID int `json:"-" param:"userId" validate:"nonzero"`
}
type GetUserByUsernameRequest ¶
type GetUserByUsernameRequest struct {
Username string `json:"-" param:"username" validate:"min=3,max=24,nonzero"`
}
type LoginUserRequest ¶
type LoginUserResponse ¶
type MovieCredit ¶
type MovieCreditInfo ¶
type MovieCreditV2 ¶
type MovieDetails ¶
type MovieDetails struct { Movie Description string `json:"description"` IMDbRating *float64 `json:"imdbRating,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` Metascore *int `json:"metascore,omitempty"` MetascoreURL *string `json:"metascoreUrl,omitempty"` Version int `json:"version"` Genres []*Genre `json:"genres"` Cast []*MovieCredit `json:"cast"` }
type MovieDetailsV2 ¶
type MovieDetailsV2 struct { Movie Description string `json:"description"` IMDbRating *float64 `json:"imdbRating,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` Metascore *int `json:"metascore,omitempty"` MetascoreURL *string `json:"metascoreUrl,omitempty"` Version int `json:"version"` Genres []*Genre `json:"genres"` Cast []*MovieCreditV2 `json:"cast"` }
type PaginatedRequest ¶
type PaginatedRequest struct { Page int `json:"page" query:"page"` Size int `json:"size" query:"size"` }
func (*PaginatedRequest) SetPage ¶
func (req *PaginatedRequest) SetPage(page int)
func (*PaginatedRequest) SetSize ¶
func (req *PaginatedRequest) SetSize(size int)
func (*PaginatedRequest) ToQueryParams ¶
func (req *PaginatedRequest) ToQueryParams() map[string]string
type PaginatedRequestOrdered ¶
type PaginatedRequestOrdered struct { PaginatedRequest Sort string `json:"sort" query:"sort"` Order string `json:"order" query:"order"` }
func (*PaginatedRequestOrdered) SetPage ¶
func (req *PaginatedRequestOrdered) SetPage(page int)
func (*PaginatedRequestOrdered) SetSize ¶
func (req *PaginatedRequestOrdered) SetSize(size int)
func (*PaginatedRequestOrdered) ToQueryParams ¶
func (req *PaginatedRequestOrdered) ToQueryParams() map[string]string
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Page int `json:"page" validate:"min=0"` Size int `json:"size" validate:"min=0"` Total int `json:"total"` Items []T `json:"items"` }
func (*PaginatedResponse[T]) GetItems ¶
func (res *PaginatedResponse[T]) GetItems() []T
func (*PaginatedResponse[T]) GetPage ¶
func (res *PaginatedResponse[T]) GetPage() int
func (*PaginatedResponse[T]) GetSize ¶
func (res *PaginatedResponse[T]) GetSize() int
func (*PaginatedResponse[T]) GetTotal ¶
func (res *PaginatedResponse[T]) GetTotal() int
type PaginatedResponseOrdered ¶
type PaginatedResponseOrdered[T any] struct { PaginatedResponse[T] Sort string `json:"sort"` Order string `json:"order"` }
func (*PaginatedResponseOrdered[T]) GetItems ¶
func (res *PaginatedResponseOrdered[T]) GetItems() []T
func (*PaginatedResponseOrdered[T]) GetPage ¶
func (res *PaginatedResponseOrdered[T]) GetPage() int
func (*PaginatedResponseOrdered[T]) GetSize ¶
func (res *PaginatedResponseOrdered[T]) GetSize() int
func (*PaginatedResponseOrdered[T]) GetTotal ¶
func (res *PaginatedResponseOrdered[T]) GetTotal() int
type PaginationGetter ¶
type PaginationSetter ¶
type RegisterUserRequest ¶
type Review ¶
type Review struct { ID int `json:"id"` MovieID int `json:"movieId"` UserID int `json:"userId"` Rating int `json:"rating"` Title string `json:"title"` Content string `json:"description"` CreatedAt time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt,omitempty"` DeletedAt *time.Time `json:"deletedAt,omitempty"` }
type Star ¶
type Star struct { ID int `json:"id"` FirstName string `json:"firstName"` MiddleName *string `json:"middleName,omitempty"` LastName string `json:"lastName"` AvatarURL *string `json:"avatarUrl,omitempty"` BirthDate time.Time `json:"birthDate"` BirthPlace *string `json:"birthPlace,omitempty"` DeathDate *time.Time `json:"deathDate,omitempty"` Bio *string `json:"bio,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` CreatedAt time.Time `json:"createdAt"` DeletedAt *time.Time `json:"deletedAt,omitempty"` }
type UpdateGenreRequest ¶
type UpdateMovieRequest ¶
type UpdateMovieRequest struct { MovieID int `json:"-" param:"movieId" validate:"nonzero"` Title *string `json:"title,omitempty" validate:"max=100"` ReleaseDate *time.Time `json:"releaseDate,omitempty"` PosterURL *string `json:"posterUrl,omitempty"` IMDbRating *float64 `json:"imdbRating,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` Metascore *int `json:"metascore,omitempty"` MetascoreURL *string `json:"metascoreUrl,omitempty"` Description *string `json:"description,omitempty"` Version int `json:"version"` GenreIDs []*int `json:"genreIds,omitempty"` Cast []*MovieCreditInfo `json:"cast,omitempty"` }
type UpdateReviewRequest ¶
type UpdateReviewRequest struct { UserID int `json:"-" param:"userId" validate:"nonzero"` ReviewID int `json:"-" param:"reviewId" validate:"nonzero"` MovieID int `json:"movieId" validate:"nonzero"` Title *string `json:"title,omitempty" validate:"max=100"` Content *string `json:"description,omitempty" validate:"max=1000"` Rating *int `json:"rating,omitempty" validate:"min=1,max=10"` }
type UpdateStarRequest ¶
type UpdateStarRequest struct { StarID int `json:"-" param:"starId" validate:"nonzero"` FirstName *string `json:"firstName,omitempty" validate:"max=50"` MiddleName *string `json:"middleName,omitempty" validate:"max=50"` LastName *string `json:"lastName,omitempty" validate:"max=50"` AvatarURL *string `json:"avatarUrl,omitempty"` BirthDate *time.Time `json:"birthDate,omitempty"` BirthPlace *string `json:"birthPlace,omitempty" validate:"max=100"` DeathDate *time.Time `json:"deathDate,omitempty"` Bio *string `json:"bio,omitempty"` IMDbURL *string `json:"imdbUrl,omitempty"` }
type UpdateUserRequest ¶
type UpdateUserRequest struct { UserID int `json:"-" param:"userId" validate:"nonzero"` Username *string `json:"username,omitempty" validate:"username"` Password *string `json:"password,omitempty" validate:"password"` AvatarURL *string `json:"avatarUrl,omitempty"` Bio *string `json:"bio,omitempty"` }
type UpdateUserRoleRequest ¶
type UserWithPassword ¶
Click to show internal directories.
Click to hide internal directories.