Example #1
0
// GetTransaction endpoint retrieves a certain transaction based on its Id
func (t *TransactionsAPI) GetTransaction(params *api.Request) api.Response {
	transactionID, found, err := filter.GetIDParameter("transactionId", params.Form)

	if err != nil {
		return api.BadRequest(err)
	}

	if !found {
		return api.NotFound(err)
	}

	return bll.GetTransaction(transactionID)
}
Example #2
0
// GetAllSessions retrieves all the sessions for a certain user account
func (a *AuthAPI) GetAllSessions(params *api.Request) api.Response {
	userID, found, err := filter.GetIDParameter("token", params.Form)
	if !found {
		return api.BadRequest(api.ErrIDParamNotSpecified)
	}
	if err != nil {
		return api.InternalServerError(err)
	}

	userSessions, err := cookies.GetUserSessions(userID)
	if err != nil {
		return api.InternalServerError(err)
	}

	return api.JSONResponse(http.StatusOK, userSessions)
}