MCPcopy
hub / github.com/apache/devlake / TestExistingConnection

Function TestExistingConnection

backend/plugins/gitee/api/connection.go:106–121  ·  view source on GitHub ↗

TestExistingConnection test gitee connection @Summary test gitee connection @Description Test gitee Connection. endpoint: https://gitee.com/api/v5/ @Tags plugins/gitee @Param connectionId path int true "connection ID" @Success 200 {object} GiteeTestConnResponse "Success" @Failure 400 {string} errc

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

104// @Failure 500 {string} errcode.Error "Internal Error"
105// @Router /plugins/gitee/connections/{connectionId}/test [POST]
106func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
107 connection := &models.GiteeConnection{}
108 err := connectionHelper.First(connection, input.Params)
109 if err != nil {
110 return nil, errors.BadInput.Wrap(err, "find connection from db")
111 }
112 if err := helper.DecodeMapStruct(input.Body, connection, false); err != nil {
113 return nil, err
114 }
115 // test connection
116 result, err := testConnection(context.TODO(), connection.GiteeConn)
117 if err != nil {
118 return nil, plugin.WrapTestConnectionErrResp(basicRes, err)
119 }
120 return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil
121}
122
123// @Summary create gitee connection
124// @Description Create gitee connection

Callers

nothing calls this directly

Calls 3

WrapMethod · 0.80
testConnectionFunction · 0.70
FirstMethod · 0.65

Tested by

no test coverage detected