// ListMembers gets a list of member on board accessible by the authenticated user. func ListMembers(ctx *middleware.Context) { members, err := models.ListMembers(ctx.User, ctx.Provider, ctx.Query("project_id")) if err != nil { ctx.JSON(http.StatusUnauthorized, &models.ResponseError{ Success: false, Message: err.Error(), }) return } ctx.JSON(http.StatusOK, members) }
// ListComments gets a list of comment on board and card // accessible by the authenticated user. func ListComments(ctx *middleware.Context) { boards, err := models.ListComments(ctx.User, ctx.Provider, ctx.Query("project_id"), ctx.Query("issue_id")) if err != nil { ctx.JSON(http.StatusUnauthorized, &models.ResponseError{ Success: false, Message: err.Error(), }) return } ctx.JSON(http.StatusOK, &models.Response{ Data: boards, }) }
// ListLabels gets a list of label on board accessible by the authenticated user. func ListLabels(ctx *middleware.Context) { labels, err := models.ListLabels(ctx.User, ctx.Provider, ctx.Query("board_id")) if err != nil { ctx.JSON(http.StatusUnauthorized, &models.ResponseError{ Success: false, Message: err.Error(), }) return } ctx.JSON(http.StatusOK, &models.Response{ Data: labels, }) }
// ItemBoard gets a specific board, identified by project ID or // NAMESPACE/BOARD_NAME, which is owned by the authenticated user. func ItemBoard(ctx *middleware.Context) { board, err := models.ItemBoard(ctx.User, ctx.Provider, ctx.Query("project_id")) if err != nil { if err, ok := err.(models.ReceivedDataErr); ok { ctx.JSON(err.StatusCode, &models.ResponseError{ Success: false, Message: err.Error(), }) } ctx.JSON(http.StatusInternalServerError, &models.ResponseError{ Success: false, Message: err.Error(), }) return } ctx.JSON(http.StatusOK, &models.Response{ Data: board, }) }
// OauthUrl redirects to url for authorisation func OauthUrl(ctx *middleware.Context) { ctx.Redirect(models.AuthCodeURL(ctx.Query("provider"))) }