TestExistingConnection test feishu connection @Summary test feishu connection @Description Test feishu Connection. endpoint: https://open.feishu.cn/open-apis/ @Tags plugins/feishu @Param connectionId path int true "connection ID" @Success 200 {object} FeishuTestConnResponse "Success" @Failure 400
(input *plugin.ApiResourceInput)
| 87 | // @Failure 500 {string} errcode.Error "Internal Error" |
| 88 | // @Router /plugins/feishu/connections/{connectionId}/test [POST] |
| 89 | func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 90 | connection := &models.FeishuConnection{} |
| 91 | err := connectionHelper.First(connection, input.Params) |
| 92 | if err != nil { |
| 93 | return nil, errors.BadInput.Wrap(err, "find connection from db") |
| 94 | } |
| 95 | if err := api.DecodeMapStruct(input.Body, connection, false); err != nil { |
| 96 | return nil, err |
| 97 | } |
| 98 | // test connection |
| 99 | result, err := testConnection(context.TODO(), connection.FeishuConn) |
| 100 | if err != nil { |
| 101 | return nil, plugin.WrapTestConnectionErrResp(basicRes, err) |
| 102 | } |
| 103 | return &plugin.ApiResourceOutput{Body: result, Status: http.StatusOK}, nil |
| 104 | } |
| 105 | |
| 106 | // @Summary create feishu connection |
| 107 | // @Description Create feishu connection |
nothing calls this directly
no test coverage detected