MCPcopy Index your code
hub / github.com/apache/devlake / PatchConnection

Function PatchConnection

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

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

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

146// @Failure 500 {string} errcode.Error "Internal Error"
147// @Router /plugins/gitee/connections/{connectionId} [PATCH]
148func PatchConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
149 connection := &models.GiteeConnection{}
150 if err := connectionHelper.First(&connection, input.Params); err != nil {
151 return nil, err
152 }
153 if err := (&models.GiteeConnection{}).MergeFromRequest(connection, input.Body); err != nil {
154 return nil, errors.Convert(err)
155 }
156 if err := connectionHelper.SaveWithCreateOrUpdate(connection); err != nil {
157 return nil, err
158 }
159 return &plugin.ApiResourceOutput{Body: connection.Sanitize(), Status: http.StatusOK}, nil
160}
161
162// @Summary delete a gitee connection
163// @Description Delete a gitee 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