Documentation ¶
Index ¶
- func JSONMiddleware(next http.Handler) http.Handler
- func JWTAuth(original func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
- func LoggingMiddleware(next http.Handler) http.Handler
- func Requestor(token string) (string, error)
- func TimeoutMiddleware(next http.Handler) http.Handler
- func Verify(token string) error
- type CreateUserRequest
- type ExerciseRequest
- type ExerciseResponse
- type ExerciseService
- type HistoryRequest
- type HistoryResponse
- type HistoryService
- type LoginRequest
- type Response
- type SwoleHandler
- func (h *SwoleHandler) AuthZ(r *http.Request, OwnerID string) error
- func (h *SwoleHandler) CreateHistory(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) CreateUser(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) CreateWorkout(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) DeleteHistory(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) DeleteWorkout(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetExerciseByEquipment(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetExerciseByID(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetExerciseByMuscle(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetExerciseByName(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetHistory(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetUserByID(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetUserByName(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetWorkoutExercises(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) GetWorkoutsByUser(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) Login(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) Serve() error
- func (h *SwoleHandler) UpdateHistory(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) UpdateUserPassword(w http.ResponseWriter, r *http.Request)
- func (h *SwoleHandler) UpdateWorkout(w http.ResponseWriter, r *http.Request)
- type UserService
- type WorkoutLineItem
- type WorkoutPlanRequest
- type WorkoutRequest
- type WorkoutResponse
- type WorkoutService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWTAuth ¶
func JWTAuth(original func(w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)
Types ¶
type CreateUserRequest ¶
type ExerciseRequest ¶
type ExerciseResponse ¶
type ExerciseResponse struct {
Message string
}
type ExerciseService ¶
type ExerciseService interface { GetExerciseByID(ctx context.Context, uid string) (exercise.Exercise, error) GetExerciseByName(ctx context.Context, name string) ([]exercise.Exercise, error) GetExerciseByMuscle(ctx context.Context, name string) ([]exercise.Exercise, error) GetExerciseByEquipment(ctx context.Context, equip string) ([]exercise.Exercise, error) }
type HistoryRequest ¶
type HistoryResponse ¶
type HistoryResponse struct {
Message string
}
type HistoryService ¶
type LoginRequest ¶
type SwoleHandler ¶
type SwoleHandler struct { Router *mux.Router UService UserService EService ExerciseService WService WorkoutService HService HistoryService Server *http.Server }
func NewHandler ¶
func NewHandler(uservice UserService, eservice ExerciseService, wservice WorkoutService, hservice HistoryService) *SwoleHandler
func (*SwoleHandler) CreateHistory ¶
func (h *SwoleHandler) CreateHistory(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) CreateUser ¶
func (h *SwoleHandler) CreateUser(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) CreateWorkout ¶
func (h *SwoleHandler) CreateWorkout(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) DeleteHistory ¶
func (h *SwoleHandler) DeleteHistory(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) DeleteUser ¶
func (h *SwoleHandler) DeleteUser(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) DeleteWorkout ¶
func (h *SwoleHandler) DeleteWorkout(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetExerciseByEquipment ¶
func (h *SwoleHandler) GetExerciseByEquipment(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetExerciseByID ¶
func (h *SwoleHandler) GetExerciseByID(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetExerciseByMuscle ¶
func (h *SwoleHandler) GetExerciseByMuscle(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetExerciseByName ¶
func (h *SwoleHandler) GetExerciseByName(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetHistory ¶
func (h *SwoleHandler) GetHistory(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetUserByID ¶
func (h *SwoleHandler) GetUserByID(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetUserByName ¶
func (h *SwoleHandler) GetUserByName(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetWorkoutExercises ¶
func (h *SwoleHandler) GetWorkoutExercises(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) GetWorkoutsByUser ¶
func (h *SwoleHandler) GetWorkoutsByUser(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) Login ¶
func (h *SwoleHandler) Login(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) Serve ¶
func (h *SwoleHandler) Serve() error
func (*SwoleHandler) UpdateHistory ¶
func (h *SwoleHandler) UpdateHistory(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) UpdateUserPassword ¶
func (h *SwoleHandler) UpdateUserPassword(w http.ResponseWriter, r *http.Request)
func (*SwoleHandler) UpdateWorkout ¶
func (h *SwoleHandler) UpdateWorkout(w http.ResponseWriter, r *http.Request)
type UserService ¶
type UserService interface { CreateUser(ctx context.Context, username string, password string) (string, error) GetUserByID(ctx context.Context, uid string) (swoleuser.User, error) GetUserByName(ctx context.Context, username string) (swoleuser.User, error) UpdateUserPassword(ctx context.Context, uid string, password string) error DeleteUser(ctx context.Context, uid string) error Login(ctx context.Context, username string, password string) (string, error) }
type WorkoutLineItem ¶
type WorkoutPlanRequest ¶
type WorkoutPlanRequest struct { UID string `json:"uid"` Name string `json:"name"` Exercises []WorkoutLineItem `json:"exercises"` }
type WorkoutRequest ¶
type WorkoutRequest struct { ID string `json:"id"` PlanID string `json:"plan_id"` Name string `json:"name"` Sets string `json:"sets"` Reps string `json:"reps"` Load string `json:"load"` CreatedAt string `json:"created_at"` EditedAt string `json:"edited_at"` CreatorID string `json:"creator_id"` ExerciseID string `json:"exercise_id"` InstructionsID string `json:"instructions_id"` }
type WorkoutResponse ¶
type WorkoutResponse struct {
Message string
}
type WorkoutService ¶
type WorkoutService interface { CreateWorkout(ctx context.Context, wo []workout.Workout) error GetWorkoutExercises(ctx context.Context, id string) ([]workout.WorkoutRow, error) GetWorkoutDetails(ctx context.Context, plan_id string) ([]workout.Workout, error) GetWorkoutsByUser(ctx context.Context, user string) ([]workout.WorkoutShortInfo, error) UpdateWorkout(ctx context.Context, wo []workout.Workout) error DeleteWorkout(ctx context.Context, id []string) error }
Click to show internal directories.
Click to hide internal directories.