backend/plugins/trello/api/scope.go (26 lines of code) (raw):

/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package api import ( "github.com/apache/incubator-devlake/core/errors" "github.com/apache/incubator-devlake/core/plugin" "github.com/apache/incubator-devlake/helpers/pluginhelper/api" "github.com/apache/incubator-devlake/plugins/trello/models" ) type ScopeRes struct { models.TrelloBoard } type ScopeReq api.ScopeReq[models.TrelloBoard] // PutScope create or update trello board // @Summary create or update trello board // @Description Create or update trello board // @Tags plugins/trello // @Accept application/json // @Param connectionId path int false "connection ID" // @Param scope body ScopeReq true "json" // @Success 200 {object} []models.TrelloBoard // @Failure 400 {object} shared.ApiBody "Bad Request" // @Failure 500 {object} shared.ApiBody "Internal Error" // @Router /plugins/trello/connections/{connectionId}/scopes [PUT] func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { return scopeHelper.Put(input) } // UpdateScope patch to trello board // @Summary patch to trello board // @Description patch to trello board // @Tags plugins/trello // @Accept application/json // @Param connectionId path int false "connection ID" // @Param boardId path string false "board ID" // @Param scope body models.TrelloBoard true "json" // @Success 200 {object} models.TrelloBoard // @Failure 400 {object} shared.ApiBody "Bad Request" // @Failure 500 {object} shared.ApiBody "Internal Error" // @Router /plugins/trello/connections/{connectionId}/scopes/{boardId} [PATCH] func UpdateScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { return scopeHelper.Update(input) } // GetScopeList get Trello boards // @Summary get Trello boards // @Description get Trello boards // @Tags plugins/trello // @Param connectionId path int false "connection ID" // @Param searchTerm query string false "search term for scope name" // @Param pageSize query int false "page size, default 50" // @Param page query int false "page size, default 1" // @Success 200 {object} []models.TrelloBoard // @Failure 400 {object} shared.ApiBody "Bad Request" // @Failure 500 {object} shared.ApiBody "Internal Error" // @Router /plugins/trello/connections/{connectionId}/scopes/ [GET] func GetScopeList(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { return scopeHelper.GetScopeList(input) } // GetScope get one Trello board // @Summary get one Trello board // @Description get one Trello board // @Tags plugins/trello // @Param connectionId path int false "connection ID" // @Param boardId path string false "board ID" // @Success 200 {object} models.TrelloBoard // @Failure 400 {object} shared.ApiBody "Bad Request" // @Failure 500 {object} shared.ApiBody "Internal Error" // @Router /plugins/trello/connections/{connectionId}/scopes/{boardId} [GET] func GetScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { return scopeHelper.GetScope(input) } // DeleteScope delete plugin data associated with the scope and optionally the scope itself // @Summary delete plugin data associated with the scope and optionally the scope itself // @Description delete data associated with plugin scope // @Tags plugins/trello // @Param connectionId path int true "connection ID" // @Param scopeId path int true "scope ID" // @Param delete_data_only query bool false "Only delete the scope data, not the scope itself" // @Success 200 // @Failure 400 {object} shared.ApiBody "Bad Request" // @Failure 409 {object} api.ScopeRefDoc "References exist to this scope" // @Failure 500 {object} shared.ApiBody "Internal Error" // @Router /plugins/trello/connections/{connectionId}/scopes/{scopeId} [DELETE] func DeleteScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { return scopeHelper.Delete(input) }