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

Function testConnection

backend/plugins/slack/api/connection.go:37–55  ·  view source on GitHub ↗
(ctx context.Context, connection models.SlackConn)

Source from the content-addressed store, hash-verified

35}
36
37func testConnection(ctx context.Context, connection models.SlackConn) (*SlackTestConnResponse, errors.Error) {
38 // validate
39 if vld != nil {
40 if err := vld.Struct(connection); err != nil {
41 return nil, errors.Default.Wrap(err, "error validating target")
42 }
43 }
44 // test connection
45 _, err := api.NewApiClientFromConnection(context.TODO(), basicRes, &connection)
46 if err != nil {
47 return nil, err
48 }
49 connection = connection.Sanitize()
50 body := SlackTestConnResponse{}
51 body.Success = true
52 body.Message = "success"
53 body.Connection = &connection
54 return &body, nil
55}
56
57// TestConnection test slack connection
58// @Summary test slack connection

Callers 2

TestConnectionFunction · 0.70
TestExistingConnectionFunction · 0.70

Calls 2

WrapMethod · 0.80
SanitizeMethod · 0.45

Tested by 2

TestConnectionFunction · 0.56
TestExistingConnectionFunction · 0.56