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

Method subscriptionUpdateURL

api/pkg/handlers/user_handler.go:196–211  ·  view source on GitHub ↗

subscriptionUpdateURL returns the subscription update URL for the authenticated entities.User @Summary Currently authenticated user subscription update URL @Description Fetches the subscription URL of the authenticated user. @Security ApiKeyAuth @Tags Users @Produce json @Success

(c fiber.Ctx)

Source from the content-addressed store, hash-verified

194// @Failure 500 {object} responses.InternalServerError
195// @Router /users/subscription-update-url [get]
196func (h *UserHandler) subscriptionUpdateURL(c fiber.Ctx) error {
197 ctx, span := h.tracer.StartFromFiberCtx(c)
198 defer span.End()
199
200 ctxLogger := h.tracer.CtxLogger(h.logger, span)
201 authUser := h.userFromContext(c)
202
203 url, err := h.service.GetSubscriptionUpdateURL(ctx, authUser.ID)
204 if err != nil {
205 msg := fmt.Sprintf("cannot get user with ID [%s]", authUser.ID)
206 ctxLogger.Error(stacktrace.Propagate(err, msg))
207 return h.responseInternalServerError(c)
208 }
209
210 return h.responseOK(c, "Subscription update URL fetched successfully", url)
211}
212
213// cancelSubscription cancels the subscription for the authenticated entities.User
214// @Summary Cancel the user's subscription

Callers

nothing calls this directly

Calls 7

userFromContextMethod · 0.80
responseOKMethod · 0.80
StartFromFiberCtxMethod · 0.65
CtxLoggerMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected