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)
| 104 | // @Failure 500 {string} errcode.Error "Internal Error" |
| 105 | // @Router /plugins/gitee/connections/{connectionId}/test [POST] |
| 106 | func 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 |
nothing calls this directly
no test coverage detected