Documentation
¶
Index ¶
- type DeleteMovieResponse
- type ListMovieResponse
- type MovieController
- func (ctl *MovieController) Add(ctx context.Context, r *MovieRequest) (*MovieResponse, error)
- func (ctl *MovieController) Delete(ctx context.Context, id string) (*DeleteMovieResponse, error)
- func (ctl *MovieController) FindAll(ctx context.Context, r *http.Request) (*ListMovieResponse, error)
- func (ctl *MovieController) FindByID(ctx context.Context, id string) (*SingleMovieResponse, error)
- func (ctl *MovieController) NewListMovieResponse(ms []*movie.Movie, r *http.Request) *ListMovieResponse
- func (ctl *MovieController) NewSingleMovieResponse(mr *MovieResponse) *SingleMovieResponse
- func (ctl *MovieController) Update(ctx context.Context, id string, r *MovieRequest) (*MovieResponse, error)
- type MovieRequest
- type MovieResponse
- type SingleMovieResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteMovieResponse ¶
type DeleteMovieResponse struct {
controller.StandardResponseFields
Data struct {
ExtlID string `json:"extl_id"`
Deleted bool `json:"deleted"`
} `json:"data"`
}
DeleteMovieResponse is the response struct for deleted Movies
type ListMovieResponse ¶
type ListMovieResponse struct {
controller.StandardResponseFields
Data []*MovieResponse `json:"data"`
}
ListMovieResponse is the response struct for multiple Movies
type MovieController ¶
type MovieController struct {
App *app.Application
SRF controller.StandardResponseFields
}
MovieController is used as the base controller for the Movie logic
func NewMovieController ¶
func NewMovieController(app *app.Application, srf controller.StandardResponseFields) *MovieController
NewMovieController initializes MovieController
func (*MovieController) Add ¶
func (ctl *MovieController) Add(ctx context.Context, r *MovieRequest) (*MovieResponse, error)
Add adds a movie to the catalog.
func (*MovieController) Delete ¶
func (ctl *MovieController) Delete(ctx context.Context, id string) (*DeleteMovieResponse, error)
Delete removes the movie given the id sent in
func (*MovieController) FindAll ¶
func (ctl *MovieController) FindAll(ctx context.Context, r *http.Request) (*ListMovieResponse, error)
FindAll finds the entire set of Movies
func (*MovieController) FindByID ¶
func (ctl *MovieController) FindByID(ctx context.Context, id string) (*SingleMovieResponse, error)
FindByID finds a movie given its' unique ID
func (*MovieController) NewListMovieResponse ¶
func (ctl *MovieController) NewListMovieResponse(ms []*movie.Movie, r *http.Request) *ListMovieResponse
NewListMovieResponse is an initializer for ListMovieResponse
func (*MovieController) NewSingleMovieResponse ¶
func (ctl *MovieController) NewSingleMovieResponse(mr *MovieResponse) *SingleMovieResponse
NewSingleMovieResponse is an initializer for SingleMovieResponse
func (*MovieController) Update ¶
func (ctl *MovieController) Update(ctx context.Context, id string, r *MovieRequest) (*MovieResponse, error)
Update updates the movie given the id sent in
type MovieRequest ¶
type MovieRequest struct {
Title string `json:"title"`
Year int `json:"year"`
Rated string `json:"rated"`
Released string `json:"release_date"`
RunTime int `json:"run_time"`
Director string `json:"director"`
Writer string `json:"writer"`
}
MovieRequest is the request struct
type MovieResponse ¶
type MovieResponse struct {
ExtlID string `json:"extl_id"`
Title string `json:"title"`
Year int `json:"year"`
Rated string `json:"rated"`
Released string `json:"release_date"`
RunTime int `json:"run_time"`
Director string `json:"director"`
Writer string `json:"writer"`
CreateTimestamp string `json:"create_timestamp"`
UpdateTimestamp string `json:"update_timestamp"`
}
MovieResponse is the response struct for a single Movie
type SingleMovieResponse ¶
type SingleMovieResponse struct {
controller.StandardResponseFields
Data *MovieResponse `json:"data"`
}
SingleMovieResponse is the response struct for multiple Movies