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

Function GetTotalPagesFromResponse

backend/plugins/tapd/tasks/shared.go:79–98  ·  view source on GitHub ↗

res will not be used

(r *http.Response, args *api.ApiCollectorArgs)

Source from the content-addressed store, hash-verified

77
78// res will not be used
79func GetTotalPagesFromResponse(r *http.Response, args *api.ApiCollectorArgs) (int, errors.Error) {
80 data := args.Ctx.GetData().(*TapdTaskData)
81 apiClient, err := NewTapdApiClient(args.Ctx.TaskContext(), data.Connection)
82 if err != nil {
83 return 0, err
84 }
85 query := url.Values{}
86 query.Set("workspace_id", fmt.Sprintf("%v", data.Options.WorkspaceId))
87 res, err := apiClient.Get(fmt.Sprintf("%s/count", r.Request.URL.Path), query, nil)
88 if err != nil {
89 return 0, err
90 }
91 var page Page
92 err = api.UnmarshalResponse(res, &page)
93
94 count := page.Data.Count
95 totalPage := count/args.PageSize + 1
96
97 return totalPage, err
98}
99
100// parseIterationChangelog function is used to parse the iteration changelog
101func parseIterationChangelog(taskCtx plugin.SubTaskContext, old string, new string) (iterationFromId int64, iterationToId int64, err errors.Error) {

Callers

nothing calls this directly

Calls 4

NewTapdApiClientFunction · 0.85
GetDataMethod · 0.65
TaskContextMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected