package
0.0.0-20241204101042-0a7be3120fdf
Repository: https://github.com/xavier-hsiao/chirpy.git
Documentation: pkg.go.dev

# Functions

@Summary Create new chirp @Description Create a new chirp message instance @Tags chirp @ID post-create-chirp @Accept json @Produce json @Param body body chirpParams true "chrip message body and the author's ID" @Success 201 {object} models.Chirp "created chirp's information" @Failure 400 {object} helpers.ErrorResponse "Chirp is too long, should be less than 140 chars" @Failure 500 {object} helpers.ErrorResponse "Internal server error: can not deal with data properly" @Router /api/chirps [post].
@Summary Create new user @Description Create a new Chirpy user @Tags user @ID post-create-user @Accept json @Produce json @Param body body userParams true "user email to get new user created" @Success 201 {object} models.User "created user's information" @Failure 500 {object} helpers.ErrorResponse "Internal server error occured" @Router /api/users [post].
No description provided by the author
@Summary Get a specific chirp @Description Retreive the chirp from database by ID @Tags chirp @ID get-chirp-by-id @Produce json @Success 200 {object} models.Chirp "Created chirp's information" @Failure 400 {object} helpers.ErrorResponse "Invalid chirp id provided" @Failure 404 {object} helpers.ErrorResponse "Chirp not found in database" @Router /api/chirps/{chirpID} [get].
@Summary Get all chirps @Description Retreive all chirps from database in ascendent order of created_at time @Tags chirp @ID get-chirps @Produce json @Success 200 {array} models.Chirp "created chirp's information" @Failure 500 {object} helpers.ErrorResponse "Internal server error: can not deal with data properly" @Router /api/chirps [get].
@Summary Login users @Description Check if the users are who they claimed @Tags user @ID post-user-login @Accept json @Produce json @Param body body userParams true "user email and passowrd" @Success 200 {object} models.User "user's information" @Failure 500 {object} helpers.ErrorResponse "Internal server error: can not deal with data properly" @Failure 401 {object} helpers.ErrorResponse "Incorrect email or password" @Router /api/login [post].
@Summary Get Metrics @Description Returns an HTML page showing the number of times Chirpy has been visited @Tags metrics @ID get-metrics @Produce html @Success 200 {string} string "HTML content displaying the visit count" @Example 200 "<html><body><h1>Welcome, Chirpy Admin</h1><p>Chirpy has been visited 42 times!</p></body></html>" @Router /admin/metrics [get].
@Summary Health check endpoint @Description Returns OK if the server is healthy @Tags health @Accept json @Produce plain @Success 200 {string} string "OK" @Router /api/healthz [get].
No description provided by the author
@Summary Reset Metrics @Description Delete all users in database and reset the number of times Chirpy has been visisted to 0 @Tags user @ID post-reset @Produce plain @Success 200 {string} string "Hits set to 0" @Failure 500 {object} helpers.ErrorResponse "Failed to delete users in db" @Router /admin/reset [post].
No description provided by the author
No description provided by the author
No description provided by the author
@Summary Validate a chirp @Description Validate a chirp's length (should be less than 14 characters) and replace profane words with **** @Tags validation @ID post-validation @Accept json @Produce json @Param body body parameters true "Chirp content to validate" @Success 200 {object} returnValues "Cleaned chirp body with profanity removed" @Failure 400 {object} helpers.ErrorResponse "Chirp is too long, should be less than 140 chars" @Failure 500 {object} helpers.ErrorResponse "Failed to decode parameters" @Router /app/validate_chirp [post].

# Structs

No description provided by the author