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

Function PatchConnection

backend/plugins/feishu/api/connection.go:131–143  ·  view source on GitHub ↗

@Summary patch feishu connection @Description Patch feishu connection @Tags plugins/feishu @Param body body models.FeishuConnection true "json body" @Success 200 {object} models.FeishuConnection @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error"

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

129// @Failure 500 {string} errcode.Error "Internal Error"
130// @Router /plugins/feishu/connections/{connectionId} [PATCH]
131func PatchConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
132 connection := &models.FeishuConnection{}
133 if err := connectionHelper.First(&connection, input.Params); err != nil {
134 return nil, err
135 }
136 if err := (&models.FeishuConnection{}).MergeFromRequest(connection, input.Body); err != nil {
137 return nil, errors.Convert(err)
138 }
139 if err := connectionHelper.SaveWithCreateOrUpdate(connection); err != nil {
140 return nil, err
141 }
142 return &plugin.ApiResourceOutput{Body: connection.Sanitize(), Status: http.StatusOK}, nil
143}
144
145// @Summary delete a feishu connection
146// @Description Delete a feishu connection

Callers

nothing calls this directly

Calls 5

SanitizeMethod · 0.95
FirstMethod · 0.65
MergeFromRequestMethod · 0.65
ConvertMethod · 0.45

Tested by

no test coverage detected