| /* |
| 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" |
| dsmodels "github.com/apache/incubator-devlake/helpers/pluginhelper/api/models" |
| _ "github.com/apache/incubator-devlake/plugins/azuredevops_go/models" // Keep imports for API docs generation |
| ) |
| |
| var _ dsmodels.DsRemoteApiScopeSearchParams // Keep imports for API docs generation |
| |
| // RemoteScopes list all available scopes on the remote server |
| // @Summary list all available scopes on the remote server |
| // @Description list all available scopes on the remote server |
| // @Accept application/json |
| // @Param connectionId path int false "connection ID" |
| // @Param groupId query string false "group ID" |
| // @Param pageToken query string false "page Token" |
| // @Failure 400 {object} shared.ApiBody "Bad Request" |
| // @Failure 500 {object} shared.ApiBody "Internal Error" |
| // @Success 200 {object} dsmodels.DsRemoteApiScopeList[models.AzuredevopsRepo] |
| // @Tags plugins/azuredevops |
| // @Router /plugins/azuredevops/connections/{connectionId}/remote-scopes [GET] |
| func RemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| return raScopeList.Get(input) |
| } |
| |
| // SearchRemoteScopes searches scopes on the remote server |
| // @Summary searches scopes on the remote server |
| // @Description searches scopes on the remote server |
| // @Accept application/json |
| // @Param connectionId path int false "connection ID" |
| // @Param search query string false "search" |
| // @Param page query int false "page number" |
| // @Param pageSize query int false "page size per page" |
| // @Failure 400 {object} shared.ApiBody "Bad Request" |
| // @Failure 500 {object} shared.ApiBody "Internal Error" |
| // @Success 200 {object} dsmodels.DsRemoteApiScopeList[models.AzuredevopsRepo] "the parentIds are always null" |
| // @Tags plugins/azuredevops |
| // @Router /plugins/azuredevops/connections/{connectionId}/search-remote-scopes [GET] |
| func SearchRemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| return raScopeSearch.Get(input) |
| } |
| |
| // Proxy is a remote server API proxy |
| // @Summary Remote server API proxy |
| // @Description Forward API requests to the specified remote server |
| // @Param connectionId path int true "connection ID" |
| // @Param path path string true "path to an API endpoint" |
| // @Tags plugins/azuredevops |
| // @Router /plugins/azuredevops/connections/{connectionId}/proxy/{path} [GET] |
| func Proxy(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| return raProxy.Proxy(input) |
| } |