MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / cancelSubscription

Method cancelSubscription

api/pkg/handlers/user_handler.go:225–240  ·  view source on GitHub ↗

cancelSubscription cancels the subscription for the authenticated entities.User @Summary Cancel the user's subscription @Description Cancel the subscription of the authenticated user. @Security ApiKeyAuth @Tags Users @Produce json @Success 200 {object} responses.NoContent

(c fiber.Ctx)

Source from the content-addressed store, hash-verified

223// @Failure 500 {object} responses.InternalServerError
224// @Router /users/subscription [delete]
225func (h *UserHandler) cancelSubscription(c fiber.Ctx) error {
226 ctx, span := h.tracer.StartFromFiberCtx(c)
227 defer span.End()
228
229 ctxLogger := h.tracer.CtxLogger(h.logger, span)
230 authUser := h.userFromContext(c)
231
232 err := h.service.InitiateSubscriptionCancel(ctx, authUser.ID)
233 if err != nil {
234 msg := fmt.Sprintf("cannot get user with ID [%s]", authUser.ID)
235 ctxLogger.Error(stacktrace.Propagate(err, msg))
236 return h.responseInternalServerError(c)
237 }
238
239 return h.responseNoContent(c, "Subscription cancelled successfully")
240}
241
242// DeleteAPIKey rotates the API Key for a user
243// @Summary Rotate the user's API Key

Callers

nothing calls this directly

Calls 7

userFromContextMethod · 0.80
responseNoContentMethod · 0.80
StartFromFiberCtxMethod · 0.65
CtxLoggerMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected