api

package
v0.0.0-...-48705a9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves HTTP requests for our banking service.

func NewServer

func NewServer(config util.Config, store db.Store) (*Server, error)

NewServer creates a new HTTP server and set up routing.

func (*Server) AddRepertoire

func (server *Server) AddRepertoire(ctx *gin.Context)

AddRepertoire godoc @Security bearerAuth @Summary Insert new repertoire @Description Insert new repertoire @ID AddRepertoire @Accept json @Produce json @Param repertoire body models.Repertoire true "Create repertoire" @Success 201 {array} models.Repertoire @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires [post]

func (*Server) AddReservation

func (server *Server) AddReservation(ctx *gin.Context)

AddReservation godoc @Security bearerAuth @Summary Insert new reservation @Description Insert new reservation @ID AddReservation @Accept json @Produce json @Param reservation body models.Reservation true "Create reservation" @Success 201 {array} models.Reservation @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /reservation [post]

func (*Server) CancelReservation

func (server *Server) CancelReservation(ctx *gin.Context)

CancelReservation godoc @Security bearerAuth @Summary Delete a single reservation @Description Delete a single reservation @ID CancelReservation @Accept json @Produce json @Param id path string true "reservation ID" @Success 200 {array} apiResponse @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /reservation/{id} [delete]

func (*Server) DeleteHall

func (server *Server) DeleteHall(ctx *gin.Context)

DeleteHall godoc @Security bearerAuth @Summary Delete a single hall @Description Delete a single hall @ID DeleteHall @Accept json @Produce json @Param id path string true "Hall ID" @Success 200 {array} apiResponse @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /halls/{id} [delete]

func (*Server) DeleteMovie

func (server *Server) DeleteMovie(ctx *gin.Context)

DeleteMovie godoc @Security bearerAuth @Summary Delete a single movie @Description Delete a single movie @ID DeleteMovie @Accept json @Produce json @Param id path string true "Movie ID" @Success 200 {array} apiResponse @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /movies/{id} [delete]

func (*Server) DeleteRepertoire

func (server *Server) DeleteRepertoire(ctx *gin.Context)

DeleteRepertoire godoc @Security bearerAuth @Summary Delete a single repertoire @Description Delete a single repertoire @ID DeleteRepertoire @Accept json @Produce json @Param id path string true "repertoire ID" @Success 200 {array} apiResponse @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires/{id} [delete]

func (*Server) DeleteRepertoireForMovie

func (server *Server) DeleteRepertoireForMovie(ctx *gin.Context)

DeleteRepertoireForMovie godoc @Security bearerAuth @Summary Delete all repertoires for the movie @Description Delete all repertoires for the movie @ID DeleteRepertoireForMovie @Accept json @Produce json @Param movie_id query string true "movie ID" @Success 200 {array} apiResponse @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires/movie [delete]

func (*Server) GetAllRepertoireForMovie

func (server *Server) GetAllRepertoireForMovie(ctx *gin.Context)

GetAllRepertoireForMovie godoc @Security bearerAuth @Summary Get all the existing repertoires for the movie between startDate and endDate @Description Get all the existing repertoires for the movie between startDate and endDate @ID GetAllRepertoireForMovie @Accept json @Produce json @Param movie_id query string true "Movie ID" @Param start_date query string true "Start Date" @Param end_date query string true "End Date" @Success 200 {array} models.Repertoire @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires/movie [get]

func (*Server) GetAllReservationsForUser

func (server *Server) GetAllReservationsForUser(ctx *gin.Context)

GetAllReservationsForUser godoc @Security bearerAuth @Summary Get all the existing reservations for user @Description Get all the existing reservations for user @ID GetAllReservationsForUser @Accept json @Produce json @Param username query string true "Username" @Success 200 {array} models.Reservation @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /reservationforuser [get]

func (*Server) GetRepertoire

func (server *Server) GetRepertoire(ctx *gin.Context)

GetRepertoire godoc @Security bearerAuth @Summary List existing repertoire by id @Description Get the existing repertoire by id @ID GetRepertoire @Accept json @Produce json @Param id path string true "Repertoire ID" @Success 200 {array} models.Repertoire @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires/{id} [get]

func (*Server) InsertHall

func (server *Server) InsertHall(ctx *gin.Context)

InsertHall godoc @Security bearerAuth @Summary Insert new hall @Description Insert new hall @ID InsertHall @Accept json @Produce json @Param hall body models.Hall true "Create hall" @Success 201 {array} models.Hall @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /halls [post]

func (*Server) InsertMovie

func (server *Server) InsertMovie(ctx *gin.Context)

InsertMovie godoc @Security bearerAuth @Summary Insert new movie @Description Insert new movie @ID InsertMovie @Accept json @Produce json @Param movie body models.Movie true "Create movie" @Success 201 {array} models.Movie @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /movies [post]

func (*Server) InsertUser

func (server *Server) InsertUser(ctx *gin.Context)

func (*Server) ListRepertoires

func (server *Server) ListRepertoires(ctx *gin.Context)

ListRepertoires godoc @Security bearerAuth @Summary List existing repertoires @Description Get the existing repertoires @ID ListRepertoires @Accept json @Produce json @Success 200 {array} models.Repertoire @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires [get]

func (*Server) Start

func (server *Server) Start(address string) error

Start runs the HTTP server on a specific address.

func (*Server) UpdateHall

func (server *Server) UpdateHall(ctx *gin.Context)

UpdateHall godoc @Security bearerAuth @Summary Update a single hall @Description Update a single hall @ID UpdateHall @Accept json @Produce json @Param id path string true "Hall ID" @Param hall body models.Hall true "Update hall" @Success 200 {array} models.Hall @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /halls/{id} [put]

func (*Server) UpdateMovie

func (server *Server) UpdateMovie(ctx *gin.Context)

UpdateMovie godoc @Security bearerAuth @Summary Update a single movie @Description Update a single movie @ID UpdateMovie @Accept json @Produce json @Param id path string true "Movie ID" @Param movie body models.Movie true "Update hall" @Success 200 {array} models.Movie @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /movies/{id} [put]

func (*Server) UpdateRepertoire

func (server *Server) UpdateRepertoire(ctx *gin.Context)

UpdateRepertoire godoc @Security bearerAuth @Summary Update a single repertoire @Description Update a single repertoire @ID UpdateRepertoire @Accept json @Produce json @Param id path string true "Repertoire ID" @Param repertoire body models.Repertoire true "Update repertoire" @Success 200 {array} models.Repertoire @Failure 400 {object} apiErrorResponse @Failure 401 {object} apiErrorResponse @Router /repertoires/{id} [put]

Jump to

Keyboard shortcuts

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