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

Function NewTapdApiClient

backend/plugins/tapd/tasks/api_client.go:27–48  ·  view source on GitHub ↗
(taskCtx plugin.TaskContext, connection *models.TapdConnection)

Source from the content-addressed store, hash-verified

25)
26
27func NewTapdApiClient(taskCtx plugin.TaskContext, connection *models.TapdConnection) (*api.ApiAsyncClient, errors.Error) {
28 // create synchronize api client so we can calculate api rate limit dynamically
29 apiClient, err := api.NewApiClientFromConnection(taskCtx.GetContext(), taskCtx, connection)
30 if err != nil {
31 return nil, err
32 }
33
34 // create rate limit calculator
35 rateLimiter := &api.ApiRateLimitCalculator{
36 UserRateLimitPerHour: connection.RateLimitPerHour,
37 }
38 asyncApiClient, err := api.CreateAsyncApiClient(
39 taskCtx,
40 apiClient,
41 rateLimiter,
42 )
43 if err != nil {
44 return nil, err
45 }
46
47 return asyncApiClient, nil
48}

Callers 1

Calls 1

GetContextMethod · 0.65

Tested by

no test coverage detected